diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index 105255b547..5a1dff2593 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -1231,24 +1231,27 @@ PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args,PyObjec PyObject* Application::sGetMarkerIndex(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/) { - char *pstr=0; - if (!PyArg_ParseTuple(args, "s", &pstr)) + char *pstr = 0; + int defSize = 9; + if (!PyArg_ParseTuple(args, "|si", &pstr, &defSize)) return NULL; PY_TRY { ParameterGrp::handle const hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); if (strcmp(pstr, "square") == 0) - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED", hGrp->GetInt("MarkerSize", defSize))); else if (strcmp(pstr, "cross") == 0) - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", hGrp->GetInt("MarkerSize", defSize))); + else if (strcmp(pstr, "plus") == 0) + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", hGrp->GetInt("MarkerSize", defSize))); else if (strcmp(pstr, "empty") == 0) - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_LINE", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_LINE", hGrp->GetInt("MarkerSize", defSize))); else if (strcmp(pstr, "quad") == 0) - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_FILLED", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_FILLED", hGrp->GetInt("MarkerSize", defSize))); else if (strcmp(pstr, "circle") == 0) - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_LINE", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_LINE", hGrp->GetInt("MarkerSize", defSize))); else - return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_FILLED", hGrp->GetInt("MarkerSize", 9))); + return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_FILLED", hGrp->GetInt("MarkerSize", defSize))); }PY_CATCH; } diff --git a/src/Gui/Inventor/MarkerBitmaps.cpp b/src/Gui/Inventor/MarkerBitmaps.cpp index 4038faa774..732cbe5f36 100644 --- a/src/Gui/Inventor/MarkerBitmaps.cpp +++ b/src/Gui/Inventor/MarkerBitmaps.cpp @@ -170,6 +170,62 @@ const char cross15_marker[CROSS15_WIDTH * CROSS15_HEIGHT + 1] = { " xx xx " " xx xx"}; +//PLUS_11_11 +const int PLUS11_WIDTH = 11; +const int PLUS11_HEIGHT = 11; +const char plus11_marker[PLUS11_WIDTH * PLUS11_HEIGHT + 1] = { + " " + " xx " + " xx " + " xx " + " xx " + " xxxxxxxxxx" + " xxxxxxxxxx" + " xx " + " xx " + " xx " + " xx "}; + + +//PLUS_13_13 +const int PLUS13_WIDTH = 13; +const int PLUS13_HEIGHT = 13; +const char plus13_marker[PLUS13_WIDTH * PLUS13_HEIGHT + 1] = { + " " + " xx " + " xx " + " xx " + " xx " + " xx " + " xxxxxxxxxxxx" + " xxxxxxxxxxxx" + " xx " + " xx " + " xx " + " xx " + " xx "}; + + +//PLUS_15_15 +const int PLUS15_WIDTH = 15; +const int PLUS15_HEIGHT = 15; +const char plus15_marker[PLUS15_WIDTH * PLUS15_HEIGHT + 1] = { + " " + " xx " + " xx " + " xx " + " xx " + " xx " + " xx " + " xxxxxxxxxxxxxx" + " xxxxxxxxxxxxxx" + " xx " + " xx " + " xx " + " xx " + " xx " + " xx "}; + //SQUARE_LINE_11_11 const int SQUARE_LINE11_WIDTH = 11; const int SQUARE_LINE11_HEIGHT = 11; @@ -417,6 +473,15 @@ MarkerBitmaps::initClass() markerIndex [std::make_pair("CROSS", 7)] = SoMarkerSet::CROSS_7_7; markerIndex [std::make_pair("CROSS", 5)] = SoMarkerSet::CROSS_5_5; + createBitmap("PLUS", 11, 11, 11, plus11_marker); + createBitmap("PLUS", 13, 13, 13, plus13_marker); + createBitmap("PLUS", 15, 15, 15, plus15_marker); + + // the built-in bitmaps of Coin + markerIndex [std::make_pair("PLUS", 9)] = SoMarkerSet::PLUS_9_9; + markerIndex [std::make_pair("PLUS", 7)] = SoMarkerSet::PLUS_7_7; + markerIndex [std::make_pair("PLUS", 5)] = SoMarkerSet::PLUS_5_5; + createBitmap("SQUARE_LINE", 11, 11, 11, squareLine11_marker); createBitmap("SQUARE_LINE", 13, 13, 13, squareLine13_marker); createBitmap("SQUARE_LINE", 15, 15, 15, squareLine15_marker); diff --git a/src/Gui/ViewProviderMeasureDistance.cpp b/src/Gui/ViewProviderMeasureDistance.cpp index 6f9d9c7a18..2c46058943 100644 --- a/src/Gui/ViewProviderMeasureDistance.cpp +++ b/src/Gui/ViewProviderMeasureDistance.cpp @@ -50,6 +50,7 @@ #include #include #include +#include using namespace Gui; @@ -168,7 +169,7 @@ void ViewProviderMeasureDistance::attach(App::DocumentObject* pcObject) lineSep->addChild(pCoords); lineSep->addChild(pLines); SoMarkerSet* points = new SoMarkerSet(); - points->markerIndex = SoMarkerSet::CROSS_9_9; + points->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9)); points->numPoints=2; lineSep->addChild(points); @@ -287,7 +288,7 @@ ViewProviderPointMarker::ViewProviderPointMarker() pCoords->ref(); pCoords->point.setNum(0); pMarker = new SoMarkerSet(); - pMarker->markerIndex = SoMarkerSet::CROSS_9_9; + pMarker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9)); pMarker->numPoints=0; pMarker->ref(); diff --git a/src/Mod/Arch/ArchEquipment.py b/src/Mod/Arch/ArchEquipment.py index 75750dfdc5..bbced33c66 100644 --- a/src/Mod/Arch/ArchEquipment.py +++ b/src/Mod/Arch/ArchEquipment.py @@ -350,7 +350,7 @@ class _ViewProviderEquipment(ArchComponent.ViewProviderComponent): sep.addChild(self.coords) self.coords.point.deleteValues(0) symbol = coin.SoMarkerSet() - symbol.markerIndex = coin.SoMarkerSet.CIRCLE_FILLED_5_5 + symbol.markerIndex = FreeCADGui.getMarkerIndex("", 5) sep.addChild(symbol) rn = vobj.RootNode rn.addChild(sep) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index ddb0dfdb49..40fb4ede37 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -285,7 +285,7 @@ def dimSymbol(symbol=None,invert=False): return coin.SoSphere() elif symbol == 1: marker = coin.SoMarkerSet() - marker.markerIndex = coin.SoMarkerSet.CIRCLE_LINE_9_9 + marker.markerIndex = FreeCADGui.getMarkerIndex("circle", 9) return marker elif symbol == 2: marker = coin.SoSeparator() diff --git a/src/Mod/Draft/DraftTrackers.py b/src/Mod/Draft/DraftTrackers.py index 4977fa9bb2..3fc5571f47 100644 --- a/src/Mod/Draft/DraftTrackers.py +++ b/src/Mod/Draft/DraftTrackers.py @@ -116,7 +116,7 @@ class snapTracker(Tracker): color = coin.SoBaseColor() color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap") self.marker = coin.SoMarkerSet() # this is the marker symbol - self.marker.markerIndex = FreeCADGui.getMarkerIndex("") + self.marker.markerIndex = FreeCADGui.getMarkerIndex("", 9) self.coords = coin.SoCoordinate3() # this is the coordinate self.coords.point.setValue((0,0,0)) node = coin.SoAnnotation() @@ -126,7 +126,7 @@ class snapTracker(Tracker): Tracker.__init__(self,children=[node],name="snapTracker") def setMarker(self,style): - self.marker.markerIndex = FreeCADGui.getMarkerIndex(style) + self.marker.markerIndex = FreeCADGui.getMarkerIndex(style, 9) def setCoords(self,point): self.coords.point.setValue((point.x,point.y,point.z)) @@ -654,7 +654,7 @@ class ghostTracker(Tracker): class editTracker(Tracker): "A node edit tracker" def __init__(self,pos=Vector(0,0,0),name="None",idx=0,objcol=None,\ - marker=coin.SoMarkerSet.SQUARE_FILLED_9_9,inactive=False): + marker=FreeCADGui.getMarkerIndex("quad", 9),inactive=False): color = coin.SoBaseColor() if objcol: color.rgb = objcol[:3] diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index 2dce5b0e1c..fc75ca0573 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -66,6 +66,7 @@ # include # include #include +#include #include #include @@ -198,7 +199,7 @@ ViewProviderDataMarker::ViewProviderDataMarker() pCoords->ref(); pCoords->point.setNum(0); pMarker = new SoMarkerSet(); - pMarker->markerIndex = SoMarkerSet::CIRCLE_FILLED_9_9; + pMarker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_FILLED", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9)); pMarker->numPoints=0; pMarker->ref(); diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp index bb5142f18e..11aaa9b6b8 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -134,7 +135,7 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -201,7 +202,7 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -266,7 +267,7 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); pointsep->addChild(markcol); pointsep->addChild(marker); @@ -330,7 +331,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -395,7 +396,7 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); pointsep->addChild(markcol); pointsep->addChild(marker); @@ -452,7 +453,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -558,7 +559,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -625,7 +626,7 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); @@ -705,7 +706,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::PLUS_7_7; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("PLUS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 7)); linesep->addChild(markcol); linesep->addChild(marker); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp index 8afdeb566e..2a0642700f 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp @@ -32,6 +32,8 @@ #include "ViewProviderDatumPoint.h" // #include #include +#include +#include using namespace PartDesignGui; @@ -65,7 +67,7 @@ void ViewProviderDatumPoint::attach ( App::DocumentObject *obj ) { SoMarkerSet* marker = new SoMarkerSet(); marker->vertexProperty = vprop; marker->numPoints = 1; - marker->markerIndex = SoMarkerSet::DIAMOND_FILLED_9_9; + marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9)); getShapeRoot ()->addChild(marker); } diff --git a/src/Mod/Robot/Gui/ViewProviderTrajectory.cpp b/src/Mod/Robot/Gui/ViewProviderTrajectory.cpp index ef34fea9dd..bdd2b5ece8 100644 --- a/src/Mod/Robot/Gui/ViewProviderTrajectory.cpp +++ b/src/Mod/Robot/Gui/ViewProviderTrajectory.cpp @@ -52,6 +52,8 @@ #include #include #include +#include +#include #include using namespace Gui; using namespace RobotGui; @@ -106,7 +108,7 @@ void ViewProviderTrajectory::attach(App::DocumentObject *pcObj) SoBaseColor * markcol = new SoBaseColor; markcol->rgb.setValue( 1.0f, 1.0f, 0.0f ); SoMarkerSet* marker = new SoMarkerSet; - marker->markerIndex=SoMarkerSet::CROSS_5_5; + marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 5)); linesep->addChild(markcol); linesep->addChild(marker);