ViewProviderReference.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "PreCompiled.h"
00025
00026 #ifndef _PreComp_
00027 # include <Poly_Polygon3D.hxx>
00028 # include <BRepBndLib.hxx>
00029 # include <BRepMesh.hxx>
00030 # include <BRepMesh_IncrementalMesh.hxx>
00031 # include <BRep_Tool.hxx>
00032 # include <BRepTools.hxx>
00033 # include <BRepAdaptor_Curve.hxx>
00034 # include <BRepAdaptor_Surface.hxx>
00035 # include <GeomAbs_CurveType.hxx>
00036 # include <GeomAbs_SurfaceType.hxx>
00037 # include <Geom_BezierCurve.hxx>
00038 # include <Geom_BSplineCurve.hxx>
00039 # include <Geom_BezierSurface.hxx>
00040 # include <Geom_BSplineSurface.hxx>
00041 # include <GeomAPI_ProjectPointOnSurf.hxx>
00042 # include <GeomLProp_SLProps.hxx>
00043 # include <gp_Trsf.hxx>
00044 # include <Poly_Array1OfTriangle.hxx>
00045 # include <Poly_Triangulation.hxx>
00046 # include <TColgp_Array1OfPnt.hxx>
00047 # include <TopoDS.hxx>
00048 # include <TopoDS_Edge.hxx>
00049 # include <TopoDS_Wire.hxx>
00050 # include <TopoDS_Face.hxx>
00051 # include <TopoDS_Shape.hxx>
00052 # include <TopoDS_Iterator.hxx>
00053 # include <TopExp_Explorer.hxx>
00054 # include <TopExp.hxx>
00055 # include <TopTools_IndexedMapOfShape.hxx>
00056 # include <Poly_PolygonOnTriangulation.hxx>
00057 # include <TColStd_Array1OfInteger.hxx>
00058 # include <TopTools_ListOfShape.hxx>
00059 # include <Inventor/SoPickedPoint.h>
00060 # include <Inventor/events/SoMouseButtonEvent.h>
00061 # include <Inventor/nodes/SoCoordinate3.h>
00062 # include <Inventor/nodes/SoDrawStyle.h>
00063 # include <Inventor/nodes/SoIndexedFaceSet.h>
00064 # include <Inventor/nodes/SoLineSet.h>
00065 # include <Inventor/nodes/SoLocateHighlight.h>
00066 # include <Inventor/nodes/SoMaterial.h>
00067 # include <Inventor/nodes/SoNormal.h>
00068 # include <Inventor/nodes/SoNormalBinding.h>
00069 # include <Inventor/nodes/SoPointSet.h>
00070 # include <Inventor/nodes/SoShapeHints.h>
00071 # include <Inventor/nodes/SoSwitch.h>
00072 # include <Inventor/nodes/SoGroup.h>
00073 # include <Inventor/nodes/SoSphere.h>
00074 # include <Inventor/nodes/SoScale.h>
00075 #endif
00076
00078 #include <Base/Console.h>
00079 #include <Base/Parameter.h>
00080 #include <Base/Exception.h>
00081 #include <App/Application.h>
00082 #include <App/Document.h>
00083 #include <Gui/SoFCSelection.h>
00084 #include <Gui/Selection.h>
00085 #include <Gui/View3DInventorViewer.h>
00086
00087
00088 #include "ViewProvider.h"
00089 #include "ViewProviderReference.h"
00090 #include "SoFCShapeObject.h"
00091
00092 #include <Mod/Part/App/PartFeature.h>
00093 #include <Mod/Part/App/PrimitiveFeature.h>
00094
00095
00096 using namespace PartGui;
00097
00098 PROPERTY_SOURCE(PartGui::ViewProviderPartReference, Gui::ViewProviderGeometryObject)
00099
00100
00101
00102
00103 ViewProviderPartReference::ViewProviderPartReference() : pcControlPoints(0)
00104 {
00105 App::Material mat;
00106 mat.ambientColor.set(0.2f,0.2f,0.2f);
00107 mat.diffuseColor.set(0.1f,0.1f,0.1f);
00108 mat.specularColor.set(0.0f,0.0f,0.0f);
00109 mat.emissiveColor.set(0.0f,0.0f,0.0f);
00110 mat.shininess = 0.0f;
00111 mat.transparency = 0.0f;
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 sPixmap = "Tree_Part";
00154
00155 }
00156
00157 ViewProviderPartReference::~ViewProviderPartReference()
00158 {
00159
00160
00161
00162
00163
00164
00165
00166
00167 }
00168
00169 void ViewProviderPartReference::onChanged(const App::Property* prop)
00170 {
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 }
00226
00227 void ViewProviderPartReference::attach(App::DocumentObject *pcFeat)
00228 {
00229
00230 ViewProviderGeometryObject::attach(pcFeat);
00231
00232 SoGroup* pcNormalRoot = new SoGroup();
00233 SoGroup* pcFlatRoot = new SoGroup();
00234 SoGroup* pcWireframeRoot = new SoGroup();
00235 SoGroup* pcPointsRoot = new SoGroup();
00236
00237
00238 pShapeHints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
00239 pShapeHints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
00240
00241
00242 pcNormalRoot->addChild(pShapeHints);
00243 pcNormalRoot->addChild(FaceRoot);
00244 pcNormalRoot->addChild(EdgeRoot);
00245 pcNormalRoot->addChild(VertexRoot);
00246
00247
00248 pcFlatRoot->addChild(pShapeHints);
00249 pcFlatRoot->addChild(FaceRoot);
00250
00251
00252 pcWireframeRoot->addChild(EdgeRoot);
00253 pcWireframeRoot->addChild(VertexRoot);
00254
00255
00256 pcPointsRoot->addChild(VertexRoot);
00257
00258
00259 addDisplayMaskMode(pcNormalRoot, "Reference");
00260 }
00261
00262 void ViewProviderPartReference::setDisplayMode(const char* ModeName)
00263 {
00264 if ( strcmp("Reference",ModeName)==0 )
00265 setDisplayMaskMode("Reference");
00266
00267 ViewProviderGeometryObject::setDisplayMode( ModeName );
00268 }
00269
00270 std::vector<std::string> ViewProviderPartReference::getDisplayModes(void) const
00271 {
00272
00273 std::vector<std::string> StrList = ViewProviderGeometryObject::getDisplayModes();
00274
00275
00276 StrList.push_back("Flat Lines");
00277 StrList.push_back("Shaded");
00278 StrList.push_back("Wireframe");
00279 StrList.push_back("Points");
00280
00281 return StrList;
00282 }
00283
00284
00285 void ViewProviderPartReference::updateData(const App::Property* prop)
00286 {
00287 }