# additional include directories
INCLUDE_DIRECTORIES(
${PTHREAD_INCLUDE_DIR}
- ${OpenCASCADE_INCLUDE_DIR}
+ ${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/GEOMUtils
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
+ ${CAS_DEFINITIONS}
${OpenCASCADE_DEFINITIONS}
${QT_DEFINITIONS}
)
# libraries to link to
SET(_link_LIBRARIES
+ ${CAS_KERNEL}
+ ${CAS_TKernel}
GEOMUtils
)
IF(SALOME_BUILD_GUI)
SET(_other_HEADERS
CurveCreator.hxx
CurveCreator_Curve.hxx
+ CurveCreator_ShapeFilter.hxx
CurveCreator_Diff.hxx
CurveCreator_Displayer.hxx
CurveCreator_ICurve.hxx
CurveCreator_Curve.cxx
CurveCreator_Diff.cxx
CurveCreator_Displayer.cxx
+ CurveCreator_ShapeFilter.cxx
CurveCreator_Operation.cxx
CurveCreator_Section.cxx
CurveCreator_Utils.cxx
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
+#include <TopoDS_Shape.hxx>
#include <AIS_ColoredShape.hxx>
#include <Prs3d_PointAspect.hxx>
#include <iostream>
{
//DEBTRACE("constructAISObject");
TopoDS_Shape aShape;
- std::map<CurveCreator_Section*, TopoDS_Shape> Sect2Wire;
- CurveCreator_Utils::constructShape( this, aShape, &Sect2Wire );
+ mySect2Wire.Clear();
+ CurveCreator_Utils::constructShape( this, aShape, &mySect2Wire );
myAISShape = new AIS_ColoredShape( aShape );
AIS_ColoredShape* AISColoredShape = dynamic_cast<AIS_ColoredShape*>(myAISShape);
- std::map<CurveCreator_Section*, TopoDS_Shape>::iterator it;
+ std::map<int, TopoDS_Shape>::iterator it;
- for ( it = Sect2Wire.begin(); it != Sect2Wire.end(); it++ )
+ //for ( it = mySect2Wire.begin(); it != mySect2Wire.end(); it++ )
+ for (int i = 1; i <= mySect2Wire.Extent(); i++ )
{
- CurveCreator_Section* aSect = it->first;
+ CurveCreator_Section* aSect = (CurveCreator_Section*)getSection(mySect2Wire.FindKey(i));
Quantity_Color aColor = aSect->myColor;
- const TopoDS_Shape& aWire = it->second;
+ const TopoDS_Shape& aWire = mySect2Wire.FindFromIndex(i);
AISColoredShape->SetCustomColor(aWire, aColor);
}
-
+
// myAISShape->SetColor( myCurveColor );
myAISShape->SetWidth( myLineWidth );
Handle(Prs3d_PointAspect) anAspect = myAISShape->Attributes()->PointAspect();
#include <list>
#include <map>
+#include <NCollection_IndexedDataMap.hxx>
struct CurveCreator_Section;
class CurveCreator_Displayer;
class AIS_Shape;
class AIS_InteractiveObject;
class Quantity_Color;
+class TopoDS_Shape;
/**
* The CurveCreator_Curve object is represented as one or more sets of
Quantity_Color myPointAspectColor;
//Quantity_Color myCurveColor;
double myLineWidth;
+ NCollection_IndexedDataMap<int, TopoDS_Shape> mySect2Wire;
+ std::vector<int> myCurSectInd;
private:
void eraseAll( bool isUpdate );
void erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
void Update();
+
+ Handle(AIS_InteractiveContext) getContext()
+ {
+ return myContext;
+ }
+
//void highlight( const AISObjectsList& theObjects, bool isHL );
protected:
--- /dev/null
+// Copyright (C) 2013-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: CurveCreator_ShapeFilter.cxx
+// Author: Ilya Shchekin
+
+
+#include "CurveCreator_ShapeFilter.hxx"
+
+#include <SelectMgr_EntityOwner.hxx>
+#include <StdSelect_BRepOwner.hxx>
+#include <TopoDS_Vertex.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(CurveCreator_ShapeFilter,SelectMgr_Filter)
+
+CurveCreator_ShapeFilter::CurveCreator_ShapeFilter()
+: SelectMgr_Filter()
+{
+}
+
+CurveCreator_ShapeFilter::~CurveCreator_ShapeFilter()
+{
+}
+
+Standard_Boolean CurveCreator_ShapeFilter::ActsOn(const TopAbs_ShapeEnum aType) const
+{
+ return (aType == TopAbs_VERTEX);
+}
+
+Standard_Boolean CurveCreator_ShapeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
+{
+ Handle(StdSelect_BRepOwner) aBO = Handle(StdSelect_BRepOwner)::DownCast(EO);
+ if (aBO.IsNull())
+ return Standard_False;
+
+ const TopoDS_Shape& aShape = aBO->Shape();
+
+ if(aShape.ShapeType()!= TopAbs_VERTEX)
+ return Standard_False;
+
+ return myShapes.Contains(aShape);
+}
+
+void CurveCreator_ShapeFilter::AddShape(const TopoDS_Shape& aShape)
+{
+ myShapes.Add(aShape);
+}
+
+void CurveCreator_ShapeFilter::RemoveShape(const TopoDS_Shape& aShape)
+{
+ myShapes.Remove(aShape);
+}
+
+void CurveCreator_ShapeFilter::ClearShapes()
+{
+ myShapes.Clear();
+}
+
--- /dev/null
+// Copyright (C) 2013-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: CurveCreator_ShapeFilter.hxx
+// Author: Ilya Shchekin
+
+
+#ifndef _CurveCreator_ShapeFilter_HeaderFile
+#define _CurveCreator_ShapeFilter_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+#include <Basics_OCCTVersion.hxx>
+#include <Standard_DefineHandle.hxx>
+#include <SelectMgr_Filter.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+class SelectMgr_EntityOwner;
+class TopoDS_Shape;
+
+
+class CurveCreator_ShapeFilter : public SelectMgr_Filter
+{
+
+public:
+
+
+ Standard_EXPORT CurveCreator_ShapeFilter();
+
+ Standard_EXPORT ~CurveCreator_ShapeFilter();
+
+ Standard_EXPORT virtual Standard_Boolean ActsOn (const TopAbs_ShapeEnum aType) const Standard_OVERRIDE;
+
+ Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& EO) const Standard_OVERRIDE;
+
+ Standard_EXPORT void AddShape (const TopoDS_Shape& aShape);
+
+ Standard_EXPORT void RemoveShape (const TopoDS_Shape& aShape);
+
+ Standard_EXPORT void ClearShapes ();
+
+
+private:
+
+ TopTools_MapOfShape myShapes;
+
+public:
+
+ DEFINE_STANDARD_RTTIEXT(CurveCreator_ShapeFilter,SelectMgr_Filter)
+
+};
+
+DEFINE_STANDARD_HANDLE(CurveCreator_ShapeFilter, SelectMgr_Filter)
+
+#endif
+
\ No newline at end of file
//=======================================================================
void CurveCreator_Utils::constructShape(
const CurveCreator_ICurve* theCurve, TopoDS_Shape& theShape,
- std::map<CurveCreator_Section*, TopoDS_Shape>* theSect2Wire )
+ NCollection_IndexedDataMap<int, TopoDS_Shape>* theSect2Wire )
{
BRep_Builder aBuilder;
TopoDS_Compound aShape;
aBuilder.Add(aShape, aWire);
if (theSect2Wire)
{
- CurveCreator_Section* aSection = (CurveCreator_Section*)theCurve->getSection(aSectionI);
- (*theSect2Wire)[aSection] = aWire;
+ //CurveCreator_Section* aSection = (CurveCreator_Section*)theCurve->getSection(aSectionI);
+ (*theSect2Wire).Add(aSectionI, aWire);
}
}
}
#include <list>
#include <vector> // TODO: remove
+#include <NCollection_IndexedDataMap.hxx>
class CurveCreator_Curve;
*/
CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve,
TopoDS_Shape& theShape,
- std::map<CurveCreator_Section*, TopoDS_Shape>* Sect2Wire = NULL);
+ NCollection_IndexedDataMap<int, TopoDS_Shape>* Sect2Wire = NULL);
/**
* Generates a curve from a shape.
#include "CurveCreator.hxx"
#include <gp_Pnt.hxx>
+#include <TopoDS_Shape.hxx>
const double LOCAL_SELECTION_TOLERANCE = 0.0001;
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewManager.h>
+#include <TopExp_Explorer.hxx>
+#include "CurveCreator_ShapeFilter.hxx"
+
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_Utilities.h>
updateActionsStates();
updateUndoRedo();
emit selectionChanged();
+ QList<int> selectedSections = mySectionView->getSelectedSections();
+ CurveCreator_Curve* Curve = ((CurveCreator_Curve*)myCurve);
+ Curve->myCurSectInd.clear();
+ foreach (int sectInd, selectedSections)
+ Curve->myCurSectInd.push_back(sectInd);
}
void CurveCreator_Widget::updateActionsStates()
Handle(V3d_View) aView3d = aView->getViewPort()->getView();
if ( !aView3d.IsNull() )
{
+ CurveCreator_Curve* Curve = ((CurveCreator_Curve*)myCurve);
+ //if (!Curve->myCurSectInd.empty())
+ //{
+ aCtx->RemoveFilters();
+ Handle(CurveCreator_ShapeFilter) filter = new CurveCreator_ShapeFilter();
+ for (int i=0; i<Curve->myCurSectInd.size(); i++)
+ {
+ int sectInd = Curve->myCurSectInd[i];
+ const TopoDS_Shape& W = Curve->mySect2Wire(sectInd+1);
+ TopExp_Explorer exp(W, TopAbs_VERTEX);
+ for (;exp.More();exp.Next())
+ filter->AddShape(exp.Current());
+ }
+ aCtx->AddFilter(filter);
+ if (aCtx->HasOpenedContext())
+ {
+ Handle(AIS_LocalContext) aLctx = aCtx->LocalContext();
+ aLctx->Filter()->Clear();
+ aLctx->AddFilter(filter);
+ }
+ //}
+
// Initialize the single selection if start and end points are equal,
// otherwise a rectangular selection.
if ( myStartPoint == myEndPoint )