--- /dev/null
+#!/bin/bash
+
+find . \( -name "*.h" -o -name "*.cpp" \) -exec cpplint.py --filter=-,+whitespace/end_of_line --verbose=0 --counting=detailed {} \+ 2>&1 | grep -v Done | tee ./tofix
+
+python correction_auto_2.py --cpplint_output_file ./tofix
+
+rm ./tofix
\ No newline at end of file
virtual ~BuildAPI_Face();
INTERFACE_1(BuildPlugin_Face::ID(),
- baseObjects, BuildPlugin_Face::BASE_OBJECTS_ID(),
+ baseObjects, BuildPlugin_Face::BASE_OBJECTS_ID(),
ModelAPI_AttributeSelectionList, /** Base objects */)
/// Modify base attribute of the feature.
virtual ~BuildAPI_Vertex();
INTERFACE_1(BuildPlugin_Vertex::ID(),
- baseObjects, BuildPlugin_Vertex::BASE_OBJECTS_ID(),
+ baseObjects, BuildPlugin_Vertex::BASE_OBJECTS_ID(),
ModelAPI_AttributeSelectionList, /** Base objects */)
/// Modify base attribute of the feature.
ResultBodyPtr aResultBody = document()->createBody(data(), anIndex);
aResultBody->store(aShell);
for(ListOfShape::const_iterator anIt = aShapes.cbegin(); anIt != aShapes.cend(); ++anIt) {
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
aFaceExp(*anIt, GeomAPI_Shape::FACE); aFaceExp.more(); aFaceExp.next()) {
GeomShapePtr aFace = aFaceExp.current();
ListOfShape aHistory;
}
// Check that it is shape on sketch.
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(aConstruction.get()) {
if(aConstruction->isInfinite()) {
return false;
}
- std::shared_ptr<GeomAPI_PlanarEdges> anEdges =
+ std::shared_ptr<GeomAPI_PlanarEdges> anEdges =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aContextShape);
if(anEdges.get()) {
if(aShape->isEqual(aContextShape)) {
GeomShapePtr aSectedEdges = aPaveFiller.shape();
int anEdgesNum = 0;
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aSectedEdges, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
anEdgesNum++;
}
// Check that selected objects have closed contours.
ListOfShape aFaces;
- GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
+ GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
aPln->direction(), anEdges, aFaces);
if(aFaces.empty()) {
theError = "Selected objects does not have closed contours.";
}
//=================================================================================================
-bool BuildPlugin_ValidatorBaseForFace::isNotObligatory(std::string theFeature,
+bool BuildPlugin_ValidatorBaseForFace::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
return false;
// Get base objects list.
if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) {
- std::string aMsg =
+ std::string aMsg =
"Error: BuildPlugin_ValidatorSubShapesSelection does not support attribute type \""
"%1\"\n Only \"%2\" supported.";
Events_InfoMessage("BuildPlugin_Validators", aMsg).
/// \class BuildPlugin_ValidatorBaseForBuild
/// \ingroup Validators
-/// \brief A validator for selection base shapes for build features.
+/// \brief A validator for selection base shapes for build features.
/// Allows to select shapes on sketch and
/// whole objects with allowed type.
class BuildPlugin_ValidatorBaseForBuild: public ModelAPI_AttributeValidator
continue;
}
GeomShapePtr aContextShape = aConstruction->shape();
- std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges =
+ std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aContextShape);
if(!aPlanarEdges.get()) {
continue;
AttributeSelectionPtr aSelection = *aListIt;
std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(aSelection->value()));
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
// Iterate on wires and add wire with this edge.
std::shared_ptr<GeomAPI_Shape> aFoundWire;
for(int anIndex = 0; anIndex < aConstruction->facesNum(); ++anIndex) {
std::shared_ptr<GeomAPI_Face> aFace = aConstruction->face(anIndex);
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
aWireExp(aFace, GeomAPI_Shape::WIRE); aWireExp.more(); aWireExp.next()) {
GeomShapePtr aWireOnFace = aWireExp.current();
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aWireOnFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Edge> anEdgeOnFace(new GeomAPI_Edge(anExp.current()));
if(anEdgeInList->isEqual(anEdgeOnFace)) {
// If wire with the same edge found. Add all other edges to list.
if(aFoundWire.get()) {
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aFoundWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Edge> anEdgeOnFace(new GeomAPI_Edge(anExp.current()));
ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin();
}
if(!isAnyContourAdded) {
- Events_InfoMessage("BuildPlugin_Wire",
+ Events_InfoMessage("BuildPlugin_Wire",
"Error: Contours already closed or no contours found for selected edges.").send();
return false;
}
if(!isElementNode(theNode))
return false;
// it's parent is "feature" or "source" or page ("case" or "box")
- if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE,
+ if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE,
WDG_GROUP, WDG_OPTIONALBOX,
WDG_TOOLBOX_BOX, WDG_SWITCH_CASE, NULL))
return false;
xmlFree(aPropChars);
std::string::iterator new_end = std::unique(result.begin(), result.end(), BothAreSpaces);
- result.erase(new_end, result.end());
+ result.erase(new_end, result.end());
return result;
}
if (aName.empty() || aGroupType.empty())
Events_InfoMessage("Config_DataModelReader",
"Reading dataModel.xml: wrong folder definition.").send();
-
+
std::string aIcon = getProperty(theNode, NODE_ICON);
std::string aEmpty = getProperty(theNode, SHOW_EMPTY);
std::string aFeatures = getProperty(theNode, FOLDER_FEATURES);
return -1;
}
-std::string getFolderFeatures(const std::string& theFolderName,
+std::string getFolderFeatures(const std::string& theFolderName,
const std::vector<std::string>& theNames,
const std::vector<std::string>& theFeatures)
{
/// Returns name of type of tree items in root
CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
- /// Returns number of folders under root
+ /// Returns number of folders under root
CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); }
/// Returns name of the folder by its Id
/// Returns name of type of tree items in sub document
CONFIG_EXPORT std::string subType() const { return mySubTypes; }
- /// Returns number of folders under sub document
+ /// Returns number of folders under sub document
CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); }
/// Returns name of the folder by its Id
Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated);
if (isNode(theNode, NODE_FEATURE, NULL)) {
storeAttribute(theNode, _ID);
- std::shared_ptr<Config_FeatureMessage>
+ std::shared_ptr<Config_FeatureMessage>
aMessage(new Config_FeatureMessage(aMenuItemEvent, this));
fillFeature(theNode, aMessage);
myFeatures.push_back(getProperty(theNode, _ID));
aSwitchNode = hasParentRecursive(aCaseNode, WDG_TOOLBOX, NULL);
}
if (!xmlStrcmp(aName, (const xmlChar *) WDG_OPTIONALBOX)) {
- /// the box is optional, attribute is in case
+ /// the box is optional, attribute is in case
/// if the optional attribute value is not empty
aSwitchNode = aCaseNode;
}
aSwitchNodeID = getProperty(aSwitchNode, _ID);
aCases.push_back(std::make_pair(aSwitchNodeID, aCaseNodeID));
- aCaseNode = hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE,
+ aCaseNode = hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE,
WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, NULL);
}
aMessage->setCases(aCases);
{
bool result = isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL);
if(!result && myIsProcessWidgets) {
- result = isNode(theNode, NODE_FEATURE,
+ result = isNode(theNode, NODE_FEATURE,
WDG_GROUP, WDG_OPTIONALBOX,
WDG_TOOLBOX, WDG_TOOLBOX_BOX,
WDG_SWITCH, WDG_SWITCH_CASE, NULL);
//Internal feature has no visual representation.
return;
}
-
+
outFeatureMessage->setText(getProperty(theFeatureNode, FEATURE_TEXT));
outFeatureMessage->setTooltip(getProperty(theFeatureNode, FEATURE_TOOLTIP));
outFeatureMessage->setIcon(getProperty(theFeatureNode, FEATURE_ICON));
virtual bool processChildren(xmlNodePtr aNode);
/// Fills feature message
- void fillFeature(xmlNodePtr theRoot,
+ void fillFeature(xmlNodePtr theRoot,
const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
private:
DWORD dwLastError = ::GetLastError();
LPSTR messageBuffer = NULL;
size_t size = ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dwLastError,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ NULL,
+ dwLastError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&messageBuffer, 0, NULL);
anErrorMsg += ": " + std::string(messageBuffer, size);
#else
/// Returns list of module's xml files
CONFIG_EXPORT const std::set<std::string>& modulePluginFiles() const;
/// Returns module name: an xml attribute from the root of the plugins.xml:
- /// e.g \code <plugins module="PartSet"> \endcode
+ /// e.g \code <plugins module="PartSet"> \endcode
CONFIG_EXPORT std::string getModuleName();
/// Detects type of the given plugin and loads it using loadLibrary or loadScript.
CONFIG_EXPORT static void loadPlugin(const std::string& thePluginName);
std::string addPlugin(const std::string& aPluginLibrary,
const std::string& aPluginScript,
const std::string& aPluginConf);
- /// Save feature in myFeaturesInFiles.
+ /// Save feature in myFeaturesInFiles.
/// Generates an error if the feature name is already registered.
void addFeature(const std::string& theFeatureName, const std::string& thePluginConfig);
Config_Properties Config_PropManager::myProps;
-Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
+Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
const std::string& theName,
const std::string& theTitle,
Config_Prop::PropType theType,
std::string Config_Translator::codec(const std::string& theContext)
-{
- return (myCodecs.count(theContext) > 0)? myCodecs[theContext] : "UTF-8";
+{
+ return (myCodecs.count(theContext) > 0)? myCodecs[theContext] : "UTF-8";
}
{
Events_ID aValidatoEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
Events_Loop* aEvLoop = Events_Loop::loop();
- std::shared_ptr<Config_ValidatorMessage>
+ std::shared_ptr<Config_ValidatorMessage>
aMessage(new Config_ValidatorMessage(aValidatoEvent, this));
std::string aValidatorId;
std::list<std::string> aParameters;
Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName)
: myXmlDoc(NULL)
{
- std::string prefix = "";
+ std::string prefix = "";
Config_Prop* aProp = Config_PropManager::findProp("Plugins", "default_path");
if (aProp)
prefix = aProp->value();
myDocumentPath = prefix + FSEP + theXmlFileName;
std::ifstream aTestFile(myDocumentPath);
- if (!aTestFile)
+ if (!aTestFile)
Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(myDocumentPath).send();
aTestFile.close();
}
}
const char* Config_XMLReader::encoding() const
-{
- return (const char*) myXmlDoc->encoding;
+{
+ return (const char*) myXmlDoc->encoding;
}
\ No newline at end of file
#endif
#endif
-#endif //CONFIG_H\r
\ No newline at end of file
+#endif //CONFIG_H
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConnectorAPI_Connector.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConnectorAPI_Connector.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Axis.cpp
-// Purpose:
+// Purpose:
//
// History:
// 15/06/16 - Sergey POKHODENKO - Creation of the file
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- setByTwoPlanes(thePlane1, theOffset1, theReverseOffset1,
+ setByTwoPlanes(thePlane1, theOffset1, theReverseOffset1,
thePlane2, theOffset2, theReverseOffset2);
}
}
const ModelHighAPI_Double& theY,
const ModelHighAPI_Double& theZ)
{
- fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_POINT_AND_DIRECTION(),
+ fillAttribute(ConstructionPlugin_Axis::CREATION_METHOD_BY_POINT_AND_DIRECTION(),
creationMethod());
fillAttribute(thePoint, firstPoint());
fillAttribute(theX, xDirection());
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Axis.h
-// Purpose:
+// Purpose:
//
// History:
// 15/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Plane.cpp
-// Purpose:
+// Purpose:
//
// History:
// 27/05/16 - Sergey POKHODENKO - Creation of the file
void ConstructionAPI_Plane::setByTwoParallelPlanes(const ModelHighAPI_Selection& thePlane1,
const ModelHighAPI_Selection& thePlane2)
{
- fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES(),
+ fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES(),
mycreationMethod);
fillAttribute(thePlane1, myplane1);
fillAttribute(thePlane2, myplane2);
{
fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod);
fillAttribute(thePlane, myplane);
- fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT(),
+ fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT(),
mycreationMethodByOtherPlane);
fillAttribute(thePoint, mycoincidentPoint);
{
fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod);
fillAttribute(thePlane, myplane);
- fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION(),
+ fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION(),
mycreationMethodByOtherPlane);
fillAttribute(theAxis, myaxis);
fillAttribute(theAngle, myangle);
AttributeBooleanPtr anAttrReverse = aBase->boolean(ConstructionPlugin_Plane::REVERSE());
theDumper << ", " << anAttrPlane << ", " << anAttrDistance << ", " << anAttrReverse;
- } else if(aCreationMethodOption ==
+ } else if(aCreationMethodOption ==
ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT()) {
- AttributeSelectionPtr anAttrPoint =
+ AttributeSelectionPtr anAttrPoint =
aBase->selection(ConstructionPlugin_Plane::COINCIDENT_POINT());
theDumper << ", " << anAttrPlane << ", " << anAttrPoint;
theDumper << ", " << anAttrPlane << ", " << anAttrAxis << ", " << anAttrAngle;
}
- } else if(aCreationMethod ==
+ } else if(aCreationMethod ==
ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) {
AttributeSelectionPtr anAttrPlane1 = aBase->selection(ConstructionPlugin_Plane::PLANE1());
AttributeSelectionPtr anAttrPlane2 = aBase->selection(ConstructionPlugin_Plane::PLANE2());
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Plane.h
-// Purpose:
+// Purpose:
//
// History:
// 27/05/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Point.cpp
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
// Name : ConstructionAPI_Point.h
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
const ModelHighAPI_Selection& theObject1,
const ModelHighAPI_Selection& theObject2);*/
-#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
+#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
// Created: 12 Dec 2014
// Author: Vitaly Smetannikov
-// Modified by CEA (delegation to Alyotech) : 29 Mar 2016
+// Modified by CEA (delegation to Alyotech) : 29 Mar 2016
#include "ConstructionPlugin_Axis.h"
{
data()->addAttribute(ConstructionPlugin_Axis::METHOD(),
ModelAPI_AttributeString::typeId());
-
+
// Attributes needed to build the axis using the "two points" method
data()->addAttribute(ConstructionPlugin_Axis::POINT_FIRST(),
ModelAPI_AttributeSelection::typeId());
ModelAPI_AttributeDouble::typeId());
data()->addAttribute(ConstructionPlugin_Axis::Z_DIRECTION(),
ModelAPI_AttributeDouble::typeId());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
ConstructionPlugin_Axis::X_DIRECTION());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
ConstructionPlugin_Axis::Y_DIRECTION());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
ConstructionPlugin_Axis::Z_DIRECTION());
//Attributes needed to build the axis using the "three dimensions" method
AttributeDoublePtr aXAttr = data()->real(ConstructionPlugin_Axis::X_DIRECTION());
AttributeDoublePtr aYAttr = data()->real(ConstructionPlugin_Axis::Y_DIRECTION());
AttributeDoublePtr aZAttr = data()->real(ConstructionPlugin_Axis::Z_DIRECTION());
- if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) &&
+ if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) &&
(aYAttr.get() != NULL) && (aZAttr.get() != NULL)) {
GeomShapePtr aShape1 = aRef1->value();
if (!aShape1.get())
aShape1 = aRef1->context()->shape();
- std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aXAttr->value(),
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aXAttr->value(),
aYAttr->value(),
aZAttr->value()));
if (aShape1->isVertex() && (!aShape1->isEqual(aVertex))) {
double aDY = data()->real(DY())->value();
double aDZ = data()->real(DZ())->value();
- if (fabs(aDX) < MINIMAL_LENGTH() && fabs(aDY) < MINIMAL_LENGTH() &&
+ if (fabs(aDX) < MINIMAL_LENGTH() && fabs(aDY) < MINIMAL_LENGTH() &&
fabs(aDZ) < MINIMAL_LENGTH()) {
setError("Axis builder with dimensions :: all dimensions are null", false);
return ;
ResultConstructionPtr aConstr = document()->createConstruction(data());
aConstr->setInfinite(true);
aConstr->setShape(anEdge);
- setResult(aConstr);
+ setResult(aConstr);
}
void ConstructionPlugin_Axis::createAxisByLine()
// Created: 12 Dec 2014
// Author: Vitaly Smetannikov
-// Modified by CEA (delegation to Alyotech) : 29 Mar 2016
+// Modified by CEA (delegation to Alyotech) : 29 Mar 2016
#ifndef ConstructionPlugin_Axis_H
#define ConstructionPlugin_Axis_H
GeomShapePtr aShape;
std::string aCreationMethod = string(CREATION_METHOD())->value();
- if(aCreationMethod == CREATION_METHOD_BY_GENERAL_EQUATION() ||
+ if(aCreationMethod == CREATION_METHOD_BY_GENERAL_EQUATION() ||
aCreationMethod == "PlaneByGeneralEquation") {
aShape = createByGeneralEquation();
} else if(aCreationMethod == CREATION_METHOD_BY_THREE_POINTS()) {
{
std::vector<int> aColor;
// get color from the attribute of the result
- if (theResult.get() != NULL &&
+ if (theResult.get() != NULL &&
theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get() && aColorAttr->size()) {
anAttrC->isInitialized() && anAttrD->isInitialized() ) {
double aA = anAttrA->value(), aB = anAttrB->value(),
aC = anAttrC->value(), aD = anAttrD->value();
- std::shared_ptr<GeomAPI_Pln> aPlane =
+ std::shared_ptr<GeomAPI_Pln> aPlane =
std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
std::string kDefaultPlaneSize = "200";
double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size", kDefaultPlaneSize);
}
std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anAxisShape));
- std::shared_ptr<GeomAPI_Ax1> anAxis =
+ std::shared_ptr<GeomAPI_Ax1> anAxis =
std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
anEdge->line()->direction()));
anObjects.push_back(theV1);
anObjects.push_back(theV2);
anObjects.push_back(theV3);
- std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
+ std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0);
GeomShapePtr aRes = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aFace, aBoundingPoints);
double aWgap = (aMaxX2d - aMinX2d) * 0.1;
double aHgap = (aMaxY2d - aMinY2d) * 0.1;
std::shared_ptr<GeomAPI_Face> aResFace = GeomAlgoAPI_FaceBuilder::planarFace(thePln,
- aMinX2d - aWgap, aMinY2d - aHgap, aMaxX2d - aMinX2d + 2. * aWgap,
+ aMinX2d - aWgap, aMinY2d - aHgap, aMaxX2d - aMinX2d + 2. * aWgap,
aMaxY2d - aMinY2d + 2. * aHgap);
return aResFace;
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
- AttributeSelectionPtr aLineAttribute1 =
+ AttributeSelectionPtr aLineAttribute1 =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
AttributeSelectionPtr aLineAttribute2 = aFeature->selection(theArguments.front());
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
- AttributeSelectionPtr anAttribute1 =
+ AttributeSelectionPtr anAttribute1 =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
- AttributeSelectionPtr anAttribute1 =
+ AttributeSelectionPtr anAttribute1 =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
- AttributeSelectionPtr anAttribute1 =
+ AttributeSelectionPtr anAttribute1 =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
#pragma warning(disable : 4996) // for sprintf
#endif
-void Events_InfoMessage::addParameter(double theParam)
-{
+void Events_InfoMessage::addParameter(double theParam)
+{
char aBuf[50];
int n = sprintf(aBuf, "%g", theParam);
std::string aStr(aBuf);
- myParameters.push_back(aStr);
+ myParameters.push_back(aStr);
}
-void Events_InfoMessage::addParameter(int theParam)
-{
+void Events_InfoMessage::addParameter(int theParam)
+{
char aBuf[50];
int n = sprintf(aBuf, "%d", theParam);
std::string aStr(aBuf);
- myParameters.push_back(aStr);
+ myParameters.push_back(aStr);
}
-void Events_InfoMessage::send()
-{
+void Events_InfoMessage::send()
+{
std::shared_ptr<Events_Message> aMsg(new Events_InfoMessage(*this));
- Events_Loop::loop()->send(aMsg);
+ Events_Loop::loop()->send(aMsg);
}
return aResult;
}
-std::string Events_InfoMessage::messageString() const
-{
- return insertParameters(myMessage, myParameters);
+std::string Events_InfoMessage::messageString() const
+{
+ return insertParameters(myMessage, myParameters);
}
/// Constructor
/// \param theSender a pointer on sender object
- Events_InfoMessage(const std::string& theContext,
+ Events_InfoMessage(const std::string& theContext,
const std::string& theMsg, const void* theSender = 0):
Events_Message(Events_Loop::eventByName("InfoMessage"), theSender),
myContext(theContext), myMessage(theMsg) {}
- /// default destructor
+ /// default destructor
virtual ~Events_InfoMessage() {}
/// Identifier of this event (one for all errors)
/// Set a context string
/// \param theContext a context string
- void setContext(const std::string& theContext) { myContext = theContext; }
+ void setContext(const std::string& theContext) { myContext = theContext; }
/// Returns context string
/// Set message string for translation
/// \param theMsg the string of message
- void setMessageString(const std::string& theMsg) { myMessage = theMsg; }
+ void setMessageString(const std::string& theMsg) { myMessage = theMsg; }
/// Returns message
EVENTS_EXPORT std::string messageString() const;
/// Add parameter for message string of string type
/// \param theParam the parameter
- void addParameter(const std::string& theParam)
- {
- myParameters.push_back(theParam);
+ void addParameter(const std::string& theParam)
+ {
+ myParameters.push_back(theParam);
}
/// Add parameter for message string of double type
#include <Events_Loop.h>
void Events_Listener::groupWhileFlush(const std::shared_ptr<Events_Message>& theMessage) {
- std::shared_ptr<Events_MessageGroup> aGroup =
+ std::shared_ptr<Events_MessageGroup> aGroup =
std::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
if (aGroup) {
std::map<char*, std::shared_ptr<Events_Message> >::iterator aMyGroup = myGroups.find(
MY_SENDERS[theSender]++;
if (toSend) {
- std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message> aNewOne =
std::shared_ptr<Events_Message>(new Events_LongOp(theSender));
Events_Loop::loop()->send(aNewOne);
}
MY_SENDERS[theSender] = aCount - 1;
}
if (MY_SENDERS.empty()) {
- std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message> aNewOne =
std::shared_ptr<Events_Message>(new Events_LongOp(theSender));
Events_Loop::loop()->send(aNewOne);
}
// if it is grouped message, just accumulate it
bool isFlushedNow = myFlushed.find(theMessage->eventID().myID) != myFlushed.end();
if (isGroup && !isFlushedNow) {
- std::shared_ptr<Events_MessageGroup> aGroup =
+ std::shared_ptr<Events_MessageGroup> aGroup =
std::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
if (aGroup) {
std::map<char*, std::shared_ptr<Events_Message> >::iterator aMyGroup = myGroups.find(
//! \param isGroup is true for grouping messages if possible
EVENTS_EXPORT void send(const std::shared_ptr<Events_Message>& theMessage, bool isGroup = true);
- //! Registers (or adds if such listener is already registered) a listener
+ //! Registers (or adds if such listener is already registered) a listener
//! that will be called on the event and from the defined sender
//! \param theListener the object that will listen (process) the event
//! \param theID listen for messages with this ID
//! Removes messages with the given ID: they are not needed anymore (UPDATE on close)
EVENTS_EXPORT void eraseMessages(const Events_ID& theID);
- //! Allows to disable flushes: needed in synchronization of document mechanism
+ //! Allows to disable flushes: needed in synchronization of document mechanism
//! (to synchronize all and only then flush create, update, etc in correct order)
//! \param theActivate a state about flushe is active. If false, the flush is disabled
//! \return the previous active flush state
EVENTS_EXPORT bool activateFlushes(const bool theActivate);
-
+
//! Clears all collected messages
EVENTS_EXPORT void clear(const Events_ID& theID);
class EVENTS_EXPORT Events_ID
{
/// pointer to the text-identifier of the event, unique pointer for all events of such type
- char* myID;
+ char* myID;
Events_ID(char* theID)
{
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ExchangeAPI_Export.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
fillAttribute("Regular", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()));
- fillAttribute(theSelectionList,
+ fillAttribute(theSelectionList,
aFeature->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID()));
fillAttribute(theFileFormat, aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
aFeature->execute();
const std::string & theGeometryName)
{
// TODO(spo): check that thePart is not empty
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID()));
fillAttribute(theAuthor, aFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID()));
- fillAttribute(theGeometryName,
+ fillAttribute(theGeometryName,
aFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()));
fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
aFeature->execute();
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ExchangeAPI_Export.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ExchangeAPI_Import.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
// to make import have results
theDumper << "model.do()" << std::endl;
- CompositeFeaturePtr aCompositeFeature =
+ CompositeFeaturePtr aCompositeFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aBase);
if(aCompositeFeature.get()) {
int aNbOfSubs = aCompositeFeature->numberOfSubs();
for(int anIndex = 0; anIndex < aNbOfSubs; ++anIndex) {
- std::string aSubFeatureGet =
+ std::string aSubFeatureGet =
theDumper.name(aBase) + ".subFeature(" + std::to_string((long long)anIndex) + ")";
theDumper.dumpSubFeatureNameAndColor(aSubFeatureGet, aCompositeFeature->subFeature(anIndex));
}
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ExchangeAPI_Import.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~ExchangeAPI_Import();
INTERFACE_1(ExchangePlugin_ImportFeature::ID(),
- filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(),
+ filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(),
ModelAPI_AttributeString, /** File path */
)
// complex conversion of reference id to element index
int aReferenceID = aSelection->Id();
std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
- int anElementID =
+ int anElementID =
aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString);
aXaoGroup->add(anElementID);
*/
void ExchangePlugin_ImportFeature::initAttributes()
{
- data()->addAttribute(ExchangePlugin_ImportFeature::FILE_PATH_ID(),
+ data()->addAttribute(ExchangePlugin_ImportFeature::FILE_PATH_ID(),
ModelAPI_AttributeString::typeId());
- AttributePtr aFeaturesAttribute =
- data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(),
+ AttributePtr aFeaturesAttribute =
+ data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(),
ModelAPI_AttributeRefList::typeId());
aFeaturesAttribute->setIsArgument(false);
private:
/// Loads Naming data structure to the document
- void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
+ void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
std::shared_ptr<ModelAPI_ResultBody> theResultBody);
};
}
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anObjects =
+ AttributeSelectionListPtr anObjects =
aBase->selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
/// Modify CreationMethod, to_size, from_size attributes of the feature.
FEATURESAPI_EXPORT
- void setSizes(const ModelHighAPI_Double& theToSize,
+ void setSizes(const ModelHighAPI_Double& theToSize,
const ModelHighAPI_Double& theFromSize);
/// Modify creation_method, to_size, from_size attributes of the feature.
AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID());
AttributeSelectionListPtr anAttrObjects =
aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID());
- AttributeSelectionPtr anAttrDirection =
+ AttributeSelectionPtr anAttrDirection =
aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID());
theDumper << aBase << " = model.addExtrusion";
theDumper << ", " << anAttrToSize << ", " << anAttrFromSize;
} else if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) {
- AttributeSelectionPtr anAttrToObject =
+ AttributeSelectionPtr anAttrToObject =
aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID());
AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID());
- AttributeSelectionPtr anAttrFromObject =
+ AttributeSelectionPtr anAttrFromObject =
aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID());
", " << anAttrFromObject << ", " << anAttrFromOffset;
}
- AttributeSelectionListPtr anAttrBoolObjects =
+ AttributeSelectionListPtr anAttrBoolObjects =
aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID());
theDumper << ", " << anAttrBoolObjects << ")" << std::endl;
{
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
- return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
theSize, theBooleanObjects));
}
const ModelHighAPI_Double& theSize,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection,
theSize, theBooleanObjects));
{
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
- return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
theToSize, theFromSize, theBooleanObjects));
}
{
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
- return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
theSize, theBooleanObjects));
}
{
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
- return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
theDirection, theSize, theBooleanObjects));
}
const ModelHighAPI_Double& theFromSize,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
- return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
theToSize, theFromSize, theBooleanObjects));
}
const ModelHighAPI_Double& theFromOffset,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
theBaseObjects,
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anAttrObjects =
+ AttributeSelectionListPtr anAttrObjects =
aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
- AttributeSelectionListPtr anAttrTools =
+ AttributeSelectionListPtr anAttrTools =
aBase->selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
theDumper << aBase << " = model.addIntersection(" << aDocName << ", "
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anAttrObjects =
+ AttributeSelectionListPtr anAttrObjects =
aBase->selectionList(FeaturesPlugin_Pipe::BASE_OBJECTS_ID());
AttributeSelectionPtr anAttrPath = aBase->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID());
virtual ~FeaturesAPI_Placement();
INTERFACE_5(FeaturesPlugin_Placement::ID(),
- objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(),
+ objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(),
ModelAPI_AttributeSelectionList, /** Main objects */,
startShape, FeaturesPlugin_Placement::START_SHAPE_ID(),
ModelAPI_AttributeSelection, /** Start shape */,
- endShape, FeaturesPlugin_Placement::END_SHAPE_ID(),
+ endShape, FeaturesPlugin_Placement::END_SHAPE_ID(),
ModelAPI_AttributeSelection, /** End shape */,
reverseDirection, FeaturesPlugin_Placement::REVERSE_ID(),
ModelAPI_AttributeBoolean, /** Reverse direction flag */,
virtual ~FeaturesAPI_Recover();
INTERFACE_3(FeaturesPlugin_Recover::ID(),
- baseFeature, FeaturesPlugin_Recover::BASE_FEATURE(),
+ baseFeature, FeaturesPlugin_Recover::BASE_FEATURE(),
ModelAPI_AttributeReference, /** Concealed feature */,
- recoveredList, FeaturesPlugin_Recover::RECOVERED_ENTITIES(),
+ recoveredList, FeaturesPlugin_Recover::RECOVERED_ENTITIES(),
ModelAPI_AttributeRefList, /** Recover list*/,
isPersistent, FeaturesPlugin_Recover::PERSISTENT(),
ModelAPI_AttributeBoolean, /** Is persistent flag */)
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionPtr anAttrBaseShape =
+ AttributeSelectionPtr anAttrBaseShape =
aBase->selection(FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID());
AttributeSelectionListPtr anAttrSubShapes =
aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID());
virtual ~FeaturesAPI_RemoveSubShapes();
INTERFACE_2(FeaturesPlugin_RemoveSubShapes::ID(),
- base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(),
+ base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(),
ModelAPI_AttributeSelection, /** Base */,
- subshapes, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID(),
+ subshapes, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID(),
ModelAPI_AttributeSelectionList, /** Subshapes */)
/// Modify objects attribute of the feature.
anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects;
theDumper << ", " << anAttrAxis;
- std::string aCreationMethod =
+ std::string aCreationMethod =
aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value();
if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) {
aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID());
AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID());
- theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
+ theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
", " << anAttrFromObject << ", " << anAttrFromOffset;
}
virtual ~FeaturesAPI_Revolution();
INTERFACE_10(FeaturesPlugin_Revolution::ID(),
- sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
+ sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
ModelAPI_AttributeReference, /** Sketch launcher */,
baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
ModelAPI_AttributeSelectionList, /** Base objects */,
/// Modify CreationMethod, to_angle, from_angle attributes of the feature.
FEATURESAPI_EXPORT
- void setAngles(const ModelHighAPI_Double& theToAngle,
+ void setAngles(const ModelHighAPI_Double& theToAngle,
const ModelHighAPI_Double& theFromAngle);
/// Modify CreationMethod, to_angle, from_angle attributes of the feature.
FEATURESAPI_EXPORT
void setAngle(const ModelHighAPI_Double& theAngle);
- /// Modify CreationMethod, to_object, to_offset,
+ /// Modify CreationMethod, to_object, to_offset,
/// from_object, from_offset attributes of the feature.
FEATURESAPI_EXPORT
void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects;
theDumper << ", " << anAttrAxis;
- std::string aCreationMethod =
+ std::string aCreationMethod =
aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value();
if(aCreationMethod == FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES()) {
aBase->selection(FeaturesPlugin_Revolution::TO_OBJECT_ID());
AttributeDoublePtr anAttrToOffset =
aBase->real(FeaturesPlugin_Revolution::TO_OFFSET_ID());
- AttributeSelectionPtr anAttrFromObject =
+ AttributeSelectionPtr anAttrFromObject =
aBase->selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID());
- AttributeDoublePtr anAttrFromOffset =
+ AttributeDoublePtr anAttrFromOffset =
aBase->real(FeaturesPlugin_Revolution::FROM_OFFSET_ID());
- theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
+ theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
", " << anAttrFromObject << ", " << anAttrFromOffset;
}
const ModelHighAPI_Double& theSize,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
- return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects,
+ return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects,
theAxis, theSize, theBooleanObjects));
}
const ModelHighAPI_Double& theFromAngle,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
theBaseObjects,
const ModelHighAPI_Double& theFromOffset,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
theBaseObjects,
const ModelHighAPI_Double& theSize,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
- return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects,
+ return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects,
theAxis, theSize, theBooleanObjects));
}
const ModelHighAPI_Double& theFromAngle,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
theBaseObjects,
const ModelHighAPI_Double& theFromOffset,
const std::list<ModelHighAPI_Selection>& theBooleanObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
theBaseObjects,
FEATURESAPI_EXPORT
void setAngle(const ModelHighAPI_Double& theAngle);
- /// Modify creation_method, to_object, to_offset, from_object,
+ /// Modify creation_method, to_object, to_offset, from_object,
/// from_offset attributes of the feature.
FEATURESAPI_EXPORT
void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
const ModelHighAPI_Double& theDistance)
{
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
- return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects,
+ return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects,
theAxisObject, theDistance));
}
AttributeSelectionListPtr anAttrObjects =
aBase->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID());
- theDumper << aBase << " = model.addUnion(" << aDocName <<
+ theDumper << aBase << " = model.addUnion(" << aDocName <<
", " << anAttrObjects << ")" << std::endl;
}
{
data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
- AttributeSelectionListPtr aSelection =
+ AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
// Getting objects.
- AttributeSelectionListPtr anObjectsSelList =
+ AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
if(aResCompSolidPtr.get()) {
std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
for(; anIt != aCompSolidsObjects.end(); anIt++) {
if(anIt->first->isEqual(aContextShape)) {
}
// For solids cut each object with all tools.
- for(ListOfShape::iterator
+ for(ListOfShape::iterator
anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
ListOfShape aListWithObject;
switch(aType) {
case BOOL_CUT: {
- aBoolAlgo =
+ aBoolAlgo =
GeomAlgoAPI_Boolean(aListWithObject, aTools, GeomAlgoAPI_Boolean::BOOL_CUT);
aResShape = aBoolAlgo.shape();
break;
}
case BOOL_COMMON: {
- aBoolAlgo =
+ aBoolAlgo =
GeomAlgoAPI_Boolean(aListWithObject, aTools, GeomAlgoAPI_Boolean::BOOL_COMMON);
aResShape = aBoolAlgo.shape();
break;
if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27) {
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, anObject, aTools, aResShape,
+ loadNamingDS(aResultBody, anObject, aTools, aResShape,
aBoolAlgo, *aBoolAlgo.mapOfSubShapes().get());
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
// Compsolids handling
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
anIt != aCompSolidsObjects.end(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
// Collecting solids from compsolids which will not be modified in boolean operation.
ListOfShape aNotUsedSolids;
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
if(GeomAlgoAPI_ShapeTools::volume(aFillerAlgo->shape()) > 1.e-27) {
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aCompSolid, aTools,
+ loadNamingDS(aResultBody, aCompSolid, aTools,
aFillerAlgo->shape(), aMakeShapeList, aMapOfShapes);
setResult(aResultBody, aResultIndex);
aResultIndex++;
break;
}
case BOOL_FUSE: {
- if((anObjects.size() + aTools.size() +
+ if((anObjects.size() + aTools.size() +
aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) {
std::string aFeatureError = "Error: Not enough objects for boolean operation.";
setError(aFeatureError);
aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end());
aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end());
- // Collecting solids from compsolids which will not be modified
+ // Collecting solids from compsolids which will not be modified
// in boolean operation and will be added to result.
ListOfShape aShapesToAdd;
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
anIt != aCompSolidsObjects.end(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
ListOfShape& aUsedInOperationSolids = anIt->second;
- aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
+ aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
aUsedInOperationSolids.end());
// Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
}
}
- anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
+ anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
anEdgesAndFaces.end());
// If we have compsolids then cut with not used solids all others.
if(!aShapesToAdd.empty()) {
aSolidsToFuse.clear();
- for(ListOfShape::iterator
+ for(ListOfShape::iterator
anIt = anOriginalShapes.begin(); anIt != anOriginalShapes.end(); anIt++) {
ListOfShape aOneObjectList;
aOneObjectList.push_back(*anIt);
std::shared_ptr<GeomAPI_Shape> aBackShape = anOriginalShapes.back();
anOriginalShapes.pop_back();
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
+ loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
aShape, aMakeShapeList, aMapOfShapes);
setResult(aResultBody, aResultIndex);
aResultIndex++;
// Collecting solids from compsolids which will not be modified in
// boolean operation and will be added to result.
ListOfShape aShapesToAdd;
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
anIt != aCompSolidsObjects.end(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
ListOfShape& aUsedInOperationSolids = anIt->second;
anOriginalShapes.push_back(aCompSolid);
- aShapesToSmash.insert(aShapesToSmash.end(), aUsedInOperationSolids.begin(),
+ aShapesToSmash.insert(aShapesToSmash.end(), aUsedInOperationSolids.begin(),
aUsedInOperationSolids.end());
// Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
anOriginalShapes.pop_front();
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aFrontShape, anOriginalShapes,
+ loadNamingDS(aResultBody, aFrontShape, anOriginalShapes,
aShape, aMakeShapeList, aMapOfShapes);
setResult(aResultBody, aResultIndex);
aResultIndex++;
const int aModifyTag = 1;
const int aDeletedTag = 2;
/// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aSubsolidsTag = 3;
+ const int aSubsolidsTag = 3;
const int anEdgesAndFacesTag = 10000;
theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
aModifyTag, aModName, theMapOfShapes);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
+ theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
GeomAPI_Shape::FACE, aDeletedTag);
int aTag;
std::string aName;
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
if((*anIter)->shapeType() == GeomAPI_Shape::EDGE) {
aTag = anEdgesAndFacesTag;
aTag = aModifyTag;
aName = aModName;
}
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter,
+ theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter,
aName == aModEName ? GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE,
aTag, aName, theMapOfShapes);
theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
// Getting tools.
ListOfShape aTools;
- for(ListOfMakeShape::const_iterator
+ for(ListOfMakeShape::const_iterator
anIt = aGenMakeShapes.cbegin(); anIt != aGenMakeShapes.cend(); ++anIt) {
aTools.push_back((*anIt)->shape());
}
}
// For solids cut each object with all tools.
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIt = anObjects.cbegin(); anIt != anObjects.cend(); ++anIt) {
GeomShapePtr anObject = *anIt;
ListOfShape aListWithObject;
// Collecting solids from compsolids which will not be modified in boolean operation.
ListOfShape aShapesToAdd;
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
GeomShapePtr aSolidInCompSolid = anExp.current();
ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
}
}
- if((anObjects.size() + aTools.size() +
+ if((anObjects.size() + aTools.size() +
aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) {
myFeature->setError("Error: Not enough objects for boolean operation.");
return false;
aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end());
aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end());
- // Collecting solids from compsolids which will not be
+ // Collecting solids from compsolids which will not be
// modified in boolean operation and will be added to result.
ListOfShape aShapesToAdd;
for(std::map<GeomShapePtr, ListOfShape>::iterator anIt = aCompSolidsObjects.begin();
aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end());
// Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
GeomShapePtr aSolidInCompSolid = anExp.current();
ListOfShape::iterator anIt = aUsedShapes.begin();
aTag = aModTag;
aName = aModName;
}
- theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt,
+ theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt,
(*anIt)->shapeType() == GeomAPI_Shape::EDGE ?
GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, aTag, aName, *aMap.get());
theResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE, aDelTag);
}
//=================================================================================================
-std::shared_ptr<ModelAPI_Feature> FeaturesPlugin_CompositeSketch::subFeature(const int theIndex,
+std::shared_ptr<ModelAPI_Feature> FeaturesPlugin_CompositeSketch::subFeature(const int theIndex,
bool forTree)
{
if(theIndex == 0) {
}
ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aBaseObjectSelection->context());
- if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) &&
+ if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) &&
aST == GeomAPI_Shape::WIRE) {
// It is a wire on the sketch, store it to make face later.
aSketchWiresMap[aConstruction].push_back(aBaseShape);
aBaseShape = aConstruction->shape();
if(aBaseShape.get() && !aBaseShape->isNull()) {
GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType();
- if(aST != GeomAPI_Shape::VERTEX && aST != GeomAPI_Shape::EDGE &&
+ if(aST != GeomAPI_Shape::VERTEX && aST != GeomAPI_Shape::EDGE &&
aST != GeomAPI_Shape::WIRE &&
aST != GeomAPI_Shape::FACE && aST != GeomAPI_Shape::SHELL) {
setError("Error: Selected shapes has unsupported type.");
ListOfShape aShells;
ListOfShape aFreeFaces;
GeomShapePtr aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList);
- GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL,
+ GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL,
aShells, aFreeFaces);
theBaseShapesList.insert(theBaseShapesList.end(), aFreeFaces.begin(), aFreeFaces.end());
theBaseShapesList.insert(theBaseShapesList.end(), aShells.begin(), aShells.end());
}
}
- if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
+ if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
+ theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
GeomAPI_Shape::VERTEX,
- theTag++, aGenName + "Edge",
+ theTag++, aGenName + "Edge",
*aMapOfSubShapes.get());
}
- if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
+ if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(),
+ theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(),
theBaseShape, GeomAPI_Shape::EDGE,
theTag++, aGenName + "Face",
*aMapOfSubShapes.get());
}
- std::shared_ptr<GeomAlgoAPI_MakeSweep> aMakeSweep =
+ std::shared_ptr<GeomAlgoAPI_MakeSweep> aMakeSweep =
std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
if(aMakeSweep.get()) {
// Store from shapes.
- storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
+ storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
aMakeSweep->fromShapes(), "From_", theTag);
// Store to shapes.
- storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
+ storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
aMakeSweep->toShapes(), "To_", theTag);
}
}
FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
/// \return the sub-feature by zero-base index.
- FEATURESPLUGIN_EXPORT virtual
+ FEATURESPLUGIN_EXPORT virtual
std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
/// \return the sub-feature unique identifier in this composite feature by zero-base index.
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
int& theTag)
{
- FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape,
+ FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape,
theMakeShape, theTag);
}
/// \class FeaturesPlugin_ExtrusionBoolean
/// \ingroup Plugins
/// \brief Interface for the composite extrusion feature.
-class FeaturesPlugin_ExtrusionBoolean: public FeaturesPlugin_Extrusion,
+class FeaturesPlugin_ExtrusionBoolean: public FeaturesPlugin_Extrusion,
public FeaturesPlugin_CompositeBoolean
{
public:
//=================================================================================================
void FeaturesPlugin_Intersection::initAttributes()
{
- data()->addAttribute(FeaturesPlugin_Intersection::OBJECT_LIST_ID(),
+ data()->addAttribute(FeaturesPlugin_Intersection::OBJECT_LIST_ID(),
ModelAPI_AttributeSelectionList::typeId());
- data()->addAttribute(FeaturesPlugin_Intersection::TOOL_LIST_ID(),
+ data()->addAttribute(FeaturesPlugin_Intersection::TOOL_LIST_ID(),
ModelAPI_AttributeSelectionList::typeId());
}
ListOfShape anObjects, aTools;
// Getting objects.
- AttributeSelectionListPtr anObjectsSelList =
+ AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if (!anObject.get()) {
}
// Getting tools.
- AttributeSelectionListPtr aToolsSelList =
+ AttributeSelectionListPtr aToolsSelList =
selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
for (int aToolsIndex = 0; aToolsIndex < aToolsSelList->size(); aToolsIndex++) {
std::shared_ptr<ModelAPI_AttributeSelection> aToolAttr = aToolsSelList->value(aToolsIndex);
int aResultIndex = 0;
// Create result for each object.
- for (ListOfShape::iterator
+ for (ListOfShape::iterator
anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
ListOfShape aListWithObject; aListWithObject.push_back(anObject);
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = theMakeShape.mapOfSubShapes();
const int aDeletedTag = 1;
/// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aSubsolidsTag = 2;
+ const int aSubsolidsTag = 2;
const int aModifyTag = 100000;
int aModifyToolsTag = 200000;
std::ostringstream aStream;
/// \class FeaturesPlugin_Intersection
/// \ingroup Plugins
/// \brief Intersection feature takes a list of shapes as objects and list of shapes as tools.
-/// The types of objects and tools may be different:
+/// The types of objects and tools may be different:
/// whole objects, compsoilds, solids, shells, faces or edges.
/// The result is less than the minimal dimension from pair of intersection:
/// for two solids or two faces it is wire, for the edge and face it is vertex, etc.
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
const int theIndex)
{
- // Find base. The most complicated is the real modified object (#1799 if box is partitioned by
+ // Find base. The most complicated is the real modified object (#1799 if box is partitioned by
// two planes the box is the base, not planes, independently on the order in the list).
GeomShapePtr aBaseShape;
for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
const int aDelTag = 1;
/// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aSubTag = 2;
+ const int aSubTag = 2;
int aModTag = aSubTag + 10000;
const std::string aModName = "Modified";
GeomShapePtr anObjectSubShape = anObjectSubShapesExp.current();
ListOfShape aModifiedShapes;
theMakeShape->modified(anObjectSubShape, aModifiedShapes);
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
aModIt = aModifiedShapes.cbegin(); aModIt != aModifiedShapes.cend(); ++aModIt) {
GeomShapePtr aModShape = *aModIt;
if(aMapOfSubShapes->isBound(aModShape)) {
GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType();
ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aBaseObjectSelection->context());
- if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) &&
+ if(aConstruction.get() && !aBaseShape->isEqual(aConstruction->shape()) &&
aST == GeomAPI_Shape::WIRE) {
// It is a wire on the sketch, store it to make face later.
aSketchWiresMap[aConstruction].push_back(aBaseShape);
}
} else {
// This may be the whole sketch result selected, check and get faces.
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aBaseObjectSelection->context());
if(!aConstruction.get()) {
setError("Error: One of selected sketches does not have results.");
}
} else {
for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) {
- std::shared_ptr<GeomAPI_Shape> aBaseFace =
+ std::shared_ptr<GeomAPI_Shape> aBaseFace =
std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
if(!aBaseFace.get() || aBaseFace->isNull()) {
setError("Error: One of the faces on selected sketch is Null.");
if(aCreationMethod == CREATION_METHOD_SIMPLE()) {
ListOfShape aShells;
ListOfShape aFreeFaces;
- std::shared_ptr<GeomAPI_Shape> aFacesCompound =
+ std::shared_ptr<GeomAPI_Shape> aFacesCompound =
GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList);
- GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL,
+ GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL,
aShells, aFreeFaces);
aBaseShapesList.insert(aBaseShapesList.end(), aFreeFaces.begin(), aFreeFaces.end());
aBaseShapesList.insert(aBaseShapesList.end(), aShells.begin(), aShells.end());
setError("Error: Path selection is empty.");
return;
}
- std::shared_ptr<GeomAPI_Shape> aPathShape =
+ std::shared_ptr<GeomAPI_Shape> aPathShape =
std::dynamic_pointer_cast<GeomAPI_Shape>(aPathSelection->value());
if(!aPathShape.get()) {
// Probaply it is a construction.
// Generating result for each object.
int aResultIndex = 0;
- if(aCreationMethod == CREATION_METHOD_SIMPLE() ||
+ if(aCreationMethod == CREATION_METHOD_SIMPLE() ||
aCreationMethod == CREATION_METHOD_BINORMAL()) {
for(ListOfShape::const_iterator
anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) {
}
}
- if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
+ if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX,
aGenTag++, aGenName + "Edge", *aMapOfSubShapes.get());
}
- if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
+ if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE,
aGenTag++, aGenName + "Face", *aMapOfSubShapes.get());
}
- aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, aShapeTypeToExplode,
+ aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, aShapeTypeToExplode,
aGenTag++, aGenName, *aMapOfSubShapes.get());
// Store from shapes.
int aFromTag = aGenTag;
- storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes,
+ storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes,
thePipeAlgo.fromShapes(), "From_", aFromTag);
// Store to shapes.
int aGenTag = 1;
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = thePipeAlgo.mapOfSubShapes();
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
GeomShapePtr aBaseShape = *anIter;
GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
// Store to shapes.
int aToTag = aFromTag;
- storeShapes(aResultBody, theBaseShapes.back()->shapeType(),
+ storeShapes(aResultBody, theBaseShapes.back()->shapeType(),
aMapOfSubShapes, thePipeAlgo.toShapes(), "To", aToTag);
/// \class FeaturesPlugin_Pipe
/// \ingroup Plugins
/// \brief Feature for creation of extrusion along a path.
-/// Pipe creates extrusion of objects along a path.
+/// Pipe creates extrusion of objects along a path.
/// It produces the following results from objects:\n
/// Vertex -> Edge\n
/// Edge -> Face\n
void FeaturesPlugin_Placement::initAttributes()
{
- AttributeSelectionListPtr aSelection =
+ AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
anObjectsIt++, aContext++) {
// for part results just set transformation
- if ((*aContext)->groupName() == ModelAPI_ResultPart::group()) {
+ if ((*aContext)->groupName() == ModelAPI_ResultPart::group()) {
ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aContext);
ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
aResultPart->setTrsf(aContextRes, aTrsf);
}
//LoadNamingDS
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
loadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
setResult(aResultBody, aResultIndex);
aSubShapesAttrList->clear();
ResultPtr aContext = aShapeAttrSelection->context();
- ResultCompSolidPtr aResultCompSolid =
+ ResultCompSolidPtr aResultCompSolid =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aContext);
if(!aResultCompSolid.get()) {
return;
int aResultIndex = 0;
ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin();
ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin();
- for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend();
+ for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend();
++aBaseIt, ++anAlgoIt) {
storeResult(*aBaseIt, *anAlgoIt, aResultIndex++);
}
}
// Generating result for each base shape.
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
GeomShapePtr aBaseShape = *anIter;
/// \class FeaturesPlugin_RevolutionBoolean
/// \ingroup Plugins
/// \brief Interface for the composite revolution feature.
-class FeaturesPlugin_RevolutionBoolean : public FeaturesPlugin_Revolution,
+class FeaturesPlugin_RevolutionBoolean : public FeaturesPlugin_Revolution,
public FeaturesPlugin_CompositeBoolean
{
public:
//=================================================================================================
void FeaturesPlugin_Rotation::initAttributes()
{
- AttributeSelectionListPtr aSelection =
+ AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(),
+ data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(),
ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
}
// Getting objects.
ListOfShape anObjects;
std::list<ResultPtr> aContextes;
- AttributeSelectionListPtr anObjectsSelList =
+ AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) {
selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+ } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
}
if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+ anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
anEdge->line()->direction()));
}
// Rotating each object.
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
- for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
+ for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
anObjectsIt++, aContext++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
bool isPart = (*aContext)->groupName() == ModelAPI_ResultPart::group();
//=================================================================================================
void FeaturesPlugin_Translation::initAttributes()
{
- AttributeSelectionListPtr aSelection =
+ AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Translation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
// Getting objects.
ListOfShape anObjects;
std::list<ResultPtr> aContextes;
- AttributeSelectionListPtr anObjectsSelList =
+ AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
//Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID());
if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+ } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
}
if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+ anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
anEdge->line()->direction()));
}
std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
// Getting objects.
- AttributeSelectionListPtr anObjectsSelList =
+ AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID());
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
if(aResCompSolidPtr.get()) {
std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
for(; anIt != aCompSolidsObjects.end(); anIt++) {
if(anIt->first->isEqual(aContextShape)) {
// Collecting solids from compsolids which will not be modified in
// boolean operation and will be added to result.
ListOfShape aShapesToAdd;
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
anIt != aCompSolidsObjects.end(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
const int aModifyTag = 1;
const int aDeletedTag = 2;
/// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aSubsolidsTag = 3;
+ const int aSubsolidsTag = 3;
const std::string aModName = "Modified";
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
return false;
}
- std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
DocumentPtr aDocument = theAttribute->owner()->document();
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- AttributeSelectionPtr aPathAttrSelection =
+ AttributeSelectionPtr aPathAttrSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
if(!aPathAttrSelection.get()) {
theError = "Error: This validator can only work with path selector in \"Pipe\" feature.";
return false;
}
GeomShapePtr aContextShape = aContext->shape();
- if(aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE &&
+ if(aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE &&
!aPathShape->isEqual(aContextShape)) {
theError = "Error: Local selection of wires not allowed.";
return false;
return false;
}
- if(aLocationsSelectionList->size() > 0 &&
+ if(aLocationsSelectionList->size() > 0 &&
aLocationsSelectionList->size() != aBaseObjectsSelectionList->size()) {
theError = "Error: Number of locations should be the same as base objects.";
return false;
}
//==================================================================================================
-bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeature,
+bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
return false;
return false;
}
- ResultConstructionPtr aResultConstruction =
+ ResultConstructionPtr aResultConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(!aResultConstruction.get()) {
- // It is not a result construction.
+ // It is not a result construction.
// If shape is compound check that it contains only faces and edges.
GeomShapePtr aShape = aSelectionAttr->value();
if(!aShape.get()) {
}
if(aSelectedWiresFromObjects.isBound(aWire)) {
- theError =
+ theError =
"Error: Objects with such wire already selected. Don't allow to select this object.";
return false;
}
std::string anAttributeType = theAttribute->attributeType();
if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aListAttr =
+ AttributeSelectionListPtr aListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
// If at least one attribute is invalid, the result is false.
}
} else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) {
// Getting context.
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ResultPtr aContext = anAttr->context();
if(!aContext.get()) {
return false;
}
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(aConstruction.get()) {
// Construciotn selected. Check that is is not infinite.
}
} else {
// Shape on construction selected. Check that it is a face or wire.
- if(aShape->shapeType() == GeomAPI_Shape::WIRE ||
+ if(aShape->shapeType() == GeomAPI_Shape::WIRE ||
aShape->shapeType() == GeomAPI_Shape::FACE) {
return true;
}
return false;
}
- std::list<std::string>::const_iterator
+ std::list<std::string>::const_iterator
anArgsIt = theArguments.begin(), aLast = theArguments.end();
AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt);
std::shared_ptr<GeomAPI_Edge> aDirEdge(new GeomAPI_Edge(aDirShape));
// If faces selected check that direction not parallel with them.
- AttributeSelectionListPtr aListAttr =
+ AttributeSelectionListPtr aListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aCheckAttribute);
for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
AttributeSelectionPtr anAttr = aListAttr->value(anIndex);
aShapeInList = anAttr->context()->shape();
}
bool isParallel = true;
- if(aShapeInList->shapeType() == GeomAPI_Shape::FACE ||
+ if(aShapeInList->shapeType() == GeomAPI_Shape::FACE ||
aShapeInList->shapeType() == GeomAPI_Shape::SHELL) {
- for(GeomAPI_ShapeExplorer
+ for(GeomAPI_ShapeExplorer
anExp(aShapeInList, GeomAPI_Shape::FACE); anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(anExp.current()));
isParallel = GeomAlgoAPI_ShapeTools::isParallel(aDirEdge, aFace);
}
}
} else if(aShapeInList->shapeType() == GeomAPI_Shape::COMPOUND) {
- std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges =
+ std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapeInList);
if(aPlanarEdges.get()) {
std::shared_ptr<GeomAPI_Dir> aSketchDir = aPlanarEdges->norm();
isParallel = false;
}
if(isParallel) {
- theError =
+ theError =
"Error: Direction is parallel to one of the selected face or face on selected shell.";
return false;
}
}
//==================================================================================================
-bool FeaturesPlugin_ValidatorExtrusionDir::isNotObligatory(std::string theFeature,
+bool FeaturesPlugin_ValidatorExtrusionDir::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
return false;
std::string anAttributeType = theAttribute->attributeType();
if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aListAttr =
+ AttributeSelectionListPtr aListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
// If at least one attribute is invalid, the result is false.
}
} else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) {
// Getting context.
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ResultPtr aContext = anAttr->context();
if(!aContext.get()) {
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- AttributeSelectionListPtr anAttrSelectionList =
+ AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
if(!anAttrSelectionList.get()) {
- theError =
+ theError =
"Error: This validator can only work with selection list attributes in \"Boolean\" feature.";
return false;
}
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- AttributeSelectionListPtr anAttrSelectionList =
+ AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
if(!anAttrSelectionList.get()) {
theError = "Error: This validator can only work with selection list in \"Partition\" feature.";
}
ResultPtr aContext = aSelectAttr->context();
- ResultConstructionPtr aResultConstruction =
+ ResultConstructionPtr aResultConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(aResultConstruction.get()) {
theError = "Error: Only body shapes and construction planes are allowed for selection.";
return false;
}
- ResultCompSolidPtr aResultCompsolid =
+ ResultCompSolidPtr aResultCompsolid =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aContext);
if(aResultCompsolid.get()) {
continue;
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- AttributeSelectionListPtr aSubShapesAttrList =
+ AttributeSelectionListPtr aSubShapesAttrList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
if(!aSubShapesAttrList.get()) {
- theError =
+ theError =
"Error: This validator can only work with selection list in \"Remove Sub-Shapes\" feature.";
return false;
}
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- AttributeSelectionListPtr aBaseObjectsAttrList =
+ AttributeSelectionListPtr aBaseObjectsAttrList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
if(!aBaseObjectsAttrList.get()) {
theError = "Error: This validator can only work with selection list in \"%1\" feature.";
for(int anIndex = 0; anIndex < aBaseObjectsAttrList->size(); ++anIndex) {
bool isSameFound = false;
AttributeSelectionPtr anAttrSelectionInList = aBaseObjectsAttrList->value(anIndex);
- ResultCompSolidPtr aResult =
+ ResultCompSolidPtr aResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anAttrSelectionInList->context());
if(!aResult.get()) {
continue;
}
// Get base objects attribute list.
- AttributeSelectionListPtr aBaseObejctsAttrList =
+ AttributeSelectionListPtr aBaseObejctsAttrList =
theFeature->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID());
if(!aBaseObejctsAttrList.get()) {
theError = "Error: Could not get \"%1\" attribute.";
GeomAPI_AISObject::~GeomAPI_AISObject()
{
if (!empty()) {
- // This is necessary for correct deletion of Handle entity.
+ // This is necessary for correct deletion of Handle entity.
// Without this Handle does not decremented counter to 0
Handle(AIS_InteractiveObject) *anAIS = implPtr<Handle(AIS_InteractiveObject)>();
anAIS->Nullify();
// Set default point as a '+' symbol
Handle(AIS_Shape) aShape = new AIS_Shape(aTDS);
Handle(Prs3d_Drawer) aDrawer = aShape->Attributes();
- if (aDrawer->HasOwnPointAspect())
+ if (aDrawer->HasOwnPointAspect())
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
// TODO: a bug in AIS_RadiusDimension:
// The anchor point can't be myCirc.Location() - an exception is raised.
// But we need exactly this case...
- // We want to show a radius dimension starting from the circle centre and
+ // We want to show a radius dimension starting from the circle centre and
// ending at the user-defined point.
// Also, if anchor point coincides with myP2, the radius dimension is not displayed at all.
std::shared_ptr<GeomAPI_Pnt> anAnchor = theCircle->project(theFlyoutPoint);
{
public:
/// \brief Creation of empty AIS object
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_AISObject();
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
~GeomAPI_AISObject();
/// \brief Creates AIS_Shape object using specified shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
/// Reyirns shape used for the presentation creation (can be NULL)
* \param[in] thePlane the plane which contains all points above
* \param[in] theDistance value of the distance to be shown
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
std::shared_ptr<GeomAPI_Pnt> theEndPoint,
std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
* e.g. the distance points are equal.
* \return a boolean result
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isEmptyDistanceGeometry();
/** \brief Creates AIS_RadiusDimension object
* \param[in] theFlyoutPoint the flyout of dimension
* \param[in] theRadius value of the radius to be shown
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
* \param[in] theFlyoutPoint the flyout point for relation
* \param[in] thePlane the plane which contains the lines
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
std::shared_ptr<GeomAPI_Shape> theLine2,
std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
* \param[in] theLine2 second parallel line
* \param[in] thePlane the plane which contains the lines
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
std::shared_ptr<GeomAPI_Shape> theLine2,
std::shared_ptr<GeomAPI_Pln> thePlane);
* \param[in] theShape the object
* \param[in] thePlane the plane which contains the lines
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
std::shared_ptr<GeomAPI_Pln> thePlane);
/** \brief Assigns the color for the shape
* \param[in] theColor index of the color
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setColor(const int& theColor);
/** \brief Assigns the color for the shape
* \param[in] theB value of the blue component
* \returns true if the presentation color is changed
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool setColor(int theR, int theG, int theB);
/** \brief Returns the color for the shape
* \param[in] theG value of the green component
* \param[in] theB value of the blue component
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void getColor(int& theR, int& theG, int& theB);
/** \brief Assigns the deflection to the shape
* \param[in] theDeflection value of deflection
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool setDeflection(const double theDeflection);
/** \brief Returns deflection for the shape
* \return double value
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double getDeflection() const;
/// \return Current width of the lines of shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double width();
/// \brief Assigns the width of the lines of shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool setWidth(const double& theWidth);
/// \brief Checks if the object is empty
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool empty() const;
/// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
/// Otherwise returns -1
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
int getShapeType() const;
/// Sets marker type for vertex.
/// The type has to be defined according to Acpect_TypeOfMarker
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setPointMarker(int theType, double theScale);
/// Set line type of edges
/// Has to be defined according to Aspect_TypeOfLine
/// \returns true if the object value differs from the current
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool setLineStyle(int theStyle);
/// Set transparency of the presentation (theVal = 0 ... 1)
/// \returns true if the object value differs from the current
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool setTransparensy(double theVal);
};
GEOMAPI_EXPORT double angleRadian();
/// Returns \c true if the line is reversed during angle calculation.
- /// If theIndex = 0, the result corresponds to the first line,
+ /// If theIndex = 0, the result corresponds to the first line,
/// if theIndex = 1, the to the second line
GEOMAPI_EXPORT bool isReversed(int theIndex);
};
{
public:
/// Default constructor.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax1();
/** \brief Constructor.
* \param[in] theOrigin point of origin.
* \param[in] theDir direction of axis.
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax1(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theDir);
/// Sets origin point.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin);
/// \return the plane origin point.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> origin() const;
/// Sets direction vector.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setDir(const std::shared_ptr<GeomAPI_Dir>& theDir);
/// \return direction vector.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> dir() const;
/// Reverses the unit vector of this axis and assigns the result to this axis.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void reverse();
/// \return reversed unit vector of this axis.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Ax1> reversed();
};
{
public:
/// Default constructor.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax2();
/** \brief Constructor.
* \param[in] theN direction of axis.
* \param[in] theVX x direction of axis.
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theN,
std::shared_ptr<GeomAPI_Dir> theVX);
* \param[in] theOrigin point of origin.
* \param[in] theDir direction of axis.
*/
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theDir);
/// Sets origin point.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin);
/// \return the plane origin point.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> origin() const;
/// Sets direction vector.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setDir(const std::shared_ptr<GeomAPI_Dir>& theDir);
/// \return direction vector.
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> dir() const;
};
GeomAPI_Ax3::GeomAPI_Ax3(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theDirX,
std::shared_ptr<GeomAPI_Dir> theNorm)
-: GeomAPI_Interface(new gp_Ax3(theOrigin->impl<gp_Pnt>(),
- theNorm->impl<gp_Dir>(),
+: GeomAPI_Interface(new gp_Ax3(theOrigin->impl<gp_Pnt>(),
+ theNorm->impl<gp_Dir>(),
theDirX->impl<gp_Dir>()))
{
}
{
public:
/// Default constructor
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax3();
/// Constructor
/// \param theOrigin point of origin
/// \param theDirX direction of X axis
/// \param theNorm direction of normal vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Ax3(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theDirX,
std::shared_ptr<GeomAPI_Dir> theNorm);
/// Sets origin point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin);
/// Returns the plane origin point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> origin() const;
/// Sets X direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setDirX(const std::shared_ptr<GeomAPI_Dir>& theDirX);
/// Returns X direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> dirX() const;
/// Sets Y direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setDirY(const std::shared_ptr<GeomAPI_Dir>& theDirY);
/// Returns Y direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> dirY() const;
/// Sets Z direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setNormal(const std::shared_ptr<GeomAPI_Dir>& theNorm);
/// Returns Z direction vector
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> normal() const;
/// Converts 2d coordinates from the plane to 3d space point
/// \param theX X coordinate
/// \param theY Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> to3D(double theX, double theY) const;
/// Converts 3d to 2d coordinates of the plane
/// \param theX X coordinate
/// \param theY Y coordinate
/// \param theZ Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt2d> to2D(double theX, double theY, double theZ) const;
};
double& theParameter) const
{
Handle(Geom_Circle) aCurve = new Geom_Circle(*MY_CIRC);
- return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt>(),
+ return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt>(),
theTolerance, theParameter) == Standard_True;
}
{
public:
/// Creation of circle defined by center point and circle radius
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
/// Creation of circle defined by center point, direction and circle radius
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
const std::shared_ptr<GeomAPI_Pnt2d>& theThirdPoint);
/// Return center of the circle
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt2d> center() const;
/// Return radius of the circle
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double radius() const;
/// Project point on line
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt2d> project(
const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
{
public:
/// Creation of empty (null) shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Curve();
/// Creates a curve from the shape (edge)
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Returns true if curve is not initialized
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isNull() const;
/// Returns whether the curve is linear
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isLine() const;
/// Returns whether the curve is circular
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isCircle() const;
/// Returns start parameter of the curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double startParam() const { return myStart; }
/// Returns end parameter of the curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double endParam() const { return myEnd; }
/// Returns point on the curve by parameter
/// \param theParam parameter on the curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> getPoint(double theParam);
private:
/// \brief Binds list of shapes to the key shape.
/// \param[in] theKey key shape.
- /// \param[in] theItems list of shapes.
+ /// \param[in] theItems list of shapes.
/// If shapes have duplications in list only one will be stored.
/// \returns true if items bound successfully.
GEOMAPI_EXPORT bool bind(const std::shared_ptr<GeomAPI_Shape> theKey,
return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
}
-bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
+bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
std::shared_ptr<GeomAPI_Shape> theItem)
{
bool flag(false);
- if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
+ if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
theItem->impl<TopoDS_Shape>()))
flag = true;
return flag;
return flag;
}
-const std::shared_ptr<GeomAPI_Shape>
+const std::shared_ptr<GeomAPI_Shape>
GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
{
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(
new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
return aShape;
-}
+}
bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
{
/// Adds \a theKey to me with \a theItem. Returns True if the Key was not already in the map.
GEOMAPI_EXPORT
- bool bind (const std::shared_ptr<GeomAPI_Shape> theKey,
+ bool bind (const std::shared_ptr<GeomAPI_Shape> theKey,
const std::shared_ptr<GeomAPI_Shape> theItem);
/// Merges two maps.
return MY_DIR->Angle(theArg->impl<gp_Dir>());
}
-bool GeomAPI_Dir::isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
+bool GeomAPI_Dir::isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
const double theTolerance) const
{
return MY_DIR->IsParallel(theDir->impl<gp_Dir>(), theTolerance) == Standard_True;
{
public:
/// Creation of direction by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Dir(const double theX, const double theY, const double theZ);
/// Creation of direction by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Dir(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// returns Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double z() const;
/// returns coordinates of the direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> xyz();
/// inverses the direction
GEOMAPI_EXPORT void reverse();
/// result is a scalar product of directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double dot(const std::shared_ptr<GeomAPI_Dir>& theArg) const;
/// result is a cross product of two directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> cross(const std::shared_ptr<GeomAPI_Dir>& theArg) const;
/// calculates angle between two directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double angle(const std::shared_ptr<GeomAPI_Dir>& theArg) const;
- /// \return true if the angle between this unit vector and
+ /// \return true if the angle between this unit vector and
/// theDir unit vector is equal to 0 or to Pi.
- GEOMAPI_EXPORT
- bool isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
+ GEOMAPI_EXPORT
+ bool isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
const double theTolerance = 1.e-7) const;
{
public:
/// Creation of direction by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Dir2d(const double theX, const double theY);
/// Creation of direction by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Dir2d(const std::shared_ptr<GeomAPI_XY>& theCoords);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// returns coordinates of the direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XY> xy();
/// inverses the direction
GEOMAPI_EXPORT void reverse();
/// result is a scalar product of directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double dot(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const;
/// result is a cross product of two directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double cross(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const;
/// calculates angle between two directions
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double angle(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const;
};
gp_Pnt aInPnt1 = aInAdaptor.Value(aInStart);
gp_Pnt aInPnt2 = aInAdaptor.Value(aInEnd);
- if ((!aMyPnt1.IsEqual(aInPnt1, Precision::Confusion())) ||
+ if ((!aMyPnt1.IsEqual(aInPnt1, Precision::Confusion())) ||
(!aMyPnt2.IsEqual(aInPnt2, Precision::Confusion())))
return false;
{
public:
/// Makes an undefined Edge (no geometry).
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Edge();
/// Creation of edge by the edge-shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Verifies that the edge is a line
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isLine() const;
/// Verifies that the edge is a circle
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isCircle() const;
/// Verifies that the edge is an arc of circle
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isArc() const;
- /// Returns the first vertex coordinates of the edge
- GEOMAPI_EXPORT
+ /// Returns the first vertex coordinates of the edge
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> firstPoint();
- /// Returns the Last vertex coordinates of the edge
- GEOMAPI_EXPORT
+ /// Returns the Last vertex coordinates of the edge
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> lastPoint();
/// Returns a circle if edge is based on the circle curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Circ> circle();
/// Returns a line if edge is based on the linear curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Lin> line();
/// Returns true if the current edge is geometrically equal to the given edge
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
/// Returns range of parameter on the curve
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void getRange(double& theFirst, double& theLast) const;
/// Returns true, if the edge is fully placed in the specified plane
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
- Handle(Geom_RectangularTrimmedSurface) aTrimmed =
+ Handle(Geom_RectangularTrimmedSurface) aTrimmed =
Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
if (!aTrimmed.IsNull())
aSurf = aTrimmed->BasisSurface();
{
public:
/// Creation of empty (null) shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Face();
/// Creation of face by the face-shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Face(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Returns true if the current face is geometrically equal to the given face
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theFace) const;
/// Returns true if the face is a cylindrical face
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isCylindrical() const;
/// Returns the base plane of the face (if it is planar) with location in the center of the face
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pln> getPlane() const;
};
GEOMAPI_EXPORT virtual ~GeomAPI_ICustomPrs();
/// Modifies the given presentation in the custom way.
- virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
+ virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
AISObjectPtr thePrs,
std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs) = 0;
};
bool GeomAPI_Lin::isParallel(const std::shared_ptr<GeomAPI_Lin> theLin) const
{
- return MY_LIN->Direction().IsParallel(theLin->impl<gp_Lin>().Direction(),
+ return MY_LIN->Direction().IsParallel(theLin->impl<gp_Lin>().Direction(),
Precision::Confusion()) == Standard_True;
}
{
public:
/// Creation of line defined by cordinates of start and end points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
const double theEndX, const double theEndY, const double theEndZ);
/// Creation of line defined by start and end points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theStart,
const std::shared_ptr<GeomAPI_Pnt>& theEnd);
/// Creation of line defined by origin and direction
const std::shared_ptr<GeomAPI_Dir>& theDirection);
/// Returns point on the line (first point)
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> location();
/// Returns a line direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> direction();
/// Distance between two points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
/// Intersection of two lines
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt> intersect(
const std::shared_ptr<GeomAPI_Lin>& theLine) const;
/// Project point on line
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt> project(
const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
- /// \return true if this line contains thePoint, that is,
+ /// \return true if this line contains thePoint, that is,
/// if the distance between thePoint and this line
/// is less than or equal to theLinearTolerance.
GEOMAPI_EXPORT
aVec.Reverse();
aVec.Scale(theShift);
gp_Lin2d aLin = MY_LIN2D->Translated(aVec);
- return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aLin.Location().X(),
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aLin.Location().X(),
aLin.Location().Y()));
}
{
public:
/// Creation of line defined by cordinates of start and end points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
const double theEndY);
/// Creation of line defined by start and end points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
const std::shared_ptr<GeomAPI_Pnt2d>& theEnd);
/// Creation of line defined by origin and direction
const std::shared_ptr<GeomAPI_Dir2d>& theDirection);
/// Returns point on the line (first point)
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt2d> location();
/// Returns a line direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir2d> direction();
/// Distance between two points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
/// Intersection of two lines
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt2d> intersect(
const std::shared_ptr<GeomAPI_Lin2d>& theLine) const;
/// Project point on line
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_Pnt2d> project(
const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
- /// Computes the cross product of the line direction and a vector
+ /// Computes the cross product of the line direction and a vector
/// from the line start point to the point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
/// Returns a location point shifted on theShift in perpendicular direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;
};
return false;
}
-std::shared_ptr<GeomAPI_Pnt> GeomAPI_PlanarEdges::origin() const
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_PlanarEdges::origin() const
{
if (hasPlane())
return myPlane->origin();
return std::shared_ptr<GeomAPI_Pnt>();
}
-std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirX() const
+std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirX() const
{
if (hasPlane())
return myPlane->dirX();
return std::shared_ptr<GeomAPI_Dir>();
}
-std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirY() const
+std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirY() const
{
if (hasPlane())
return myPlane->dirY();
return std::shared_ptr<GeomAPI_Dir>();
}
-std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::norm() const
+std::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::norm() const
{
if (hasPlane())
return myPlane->normal();
const std::shared_ptr<GeomAPI_Dir>& theNorm);
/// Returns whether the shapes are equal
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
private:
impl<gp_Pln>().Coefficients(theA, theB, theC, theD);
}
-bool GeomAPI_Pln::isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane,
+bool GeomAPI_Pln::isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane,
const double theTolerance)
{
if(!thePlane.get()) {
const gp_Pln& aMyPln = impl<gp_Pln>();
const gp_Pln& anOtherPln = thePlane->impl<gp_Pln>();
- return (aMyPln.Contains(anOtherPln.Location(), theTolerance) &&
+ return (aMyPln.Contains(anOtherPln.Location(), theTolerance) &&
aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance));
}
return Abs(aDot) < Precision::SquareConfusion();
}
-std::shared_ptr<GeomAPI_Pnt>
+std::shared_ptr<GeomAPI_Pnt>
GeomAPI_Pln::intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const
{
std::shared_ptr<GeomAPI_XYZ> aLineDir = theLine->direction()->xyz();
new GeomAPI_Pnt(aLineLoc->added(aLineDir->multiplied(aParam))));
}
-std::shared_ptr<GeomAPI_Pnt>
+std::shared_ptr<GeomAPI_Pnt>
GeomAPI_Pln::project(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
{
std::shared_ptr<GeomAPI_XYZ> aNormal = direction()->xyz();
std::shared_ptr<GeomAPI_XYZ> aVec = thePoint->xyz()->decreased(aLocation);
double aDot = aNormal->dot(aVec);
- std::shared_ptr<GeomAPI_XYZ> aProjection =
+ std::shared_ptr<GeomAPI_XYZ> aProjection =
aLocation->added(aVec->decreased(aNormal->multiplied(aDot)));
return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aProjection));
}
{
public:
/// Creation of plane by the axis placement
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pln(const std::shared_ptr<GeomAPI_Ax3>& theAxis);
/// Creation of plane by the point and normal
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pln(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
const std::shared_ptr<GeomAPI_Dir>& theNormal);
/// Creation of plane by coefficients (Ax+By+Cz+D=0)
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
/// Returns a point of this plane
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> location() const;
/// Returns a plane normal
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> direction() const;
/// Returns a plane x direction
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Dir> xDirection() const;
/// Returns the plane coefficients (Ax+By+Cz+D=0)
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void coefficients(double& theA, double& theB, double& theC, double& theD);
/// Returns true if planes are coincident.
{
public:
/// Creation of point by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pnt(const double theX, const double theY, const double theZ);
/// Creation of point by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pnt(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// returns Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double z() const;
/// sets X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setX(const double theX);
/// sets Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setY(const double theY);
/// sets Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setZ(const double theZ);
/// returns coordinates of the point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> xyz();
/// Distance between two points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
/// Returns whether the distance between two points is less then precision confusion
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isEqual(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
/// Projects a point to the plane defined by the origin and 2 axes vectors in this plane
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
const std::shared_ptr<GeomAPI_Dir>& theDirX,
const std::shared_ptr<GeomAPI_Dir>& theDirY);
/// Projects a point to the plane defined by the origin and 2 axes vectors in this plane
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pln>& thePln) const;
/// Translates the point along direction theDir on distance theDist
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void translate(const std::shared_ptr<GeomAPI_Dir>& theDir, double theDist);
};
{
public:
/// Creation of point by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pnt2d(const double theX, const double theY);
/// Creation of point by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Pnt2d(const std::shared_ptr<GeomAPI_XY>& theCoords);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// sets X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setX(const double theX);
/// sets Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setY(const double theY);
/// Returns the 3D point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Pnt> to3D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
const std::shared_ptr<GeomAPI_Dir>& theDirX,
const std::shared_ptr<GeomAPI_Dir>& theDirY);
/// returns coordinates of the point
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XY> xy();
/// Distance between two points
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
/// Returns whether the distance between two points is less then precision confusion
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isEqual(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
};
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND)
return false;
// list of simple elements that are not detected in connection to others
- NCollection_List<TopoDS_Shape> aNotConnected;
+ NCollection_List<TopoDS_Shape> aNotConnected;
addSimpleToList(aShape, aNotConnected);
if (aNotConnected.IsEmpty()) // an empty compound
return false;
bool aConnected = false;
NCollection_List<TopoDS_Shape>::Iterator aNewIter(aNewConnected);
for(; !aConnected && aNewIter.More(); aNewIter.Next()) {
- // checking topological connecion of aNotIter and aNewIter
+ // checking topological connecion of aNotIter and aNewIter
// (if shapes are connected, vertices are connected for sure)
TopExp_Explorer anExp2(aNewIter.Value(), TopAbs_VERTEX);
for(; !aConnected && anExp2.More(); anExp2.Next()) {
public:
/// Creation of empty (null) shape
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_Shape();
/// \return a new Shape with the same Orientation and Location and a new TShape with the same
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> emptyCopied() const;
/// Returns true if the underlied shape is null
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool isNull() const;
/// Returns whether the shapes are equal
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
/// Returns whether the shape is a vertex
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isVertex() const;
/// Returns whether the shape is an edge
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isEdge() const;
/// Returns whether the shape is a face
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isFace() const;
/// Returns whether the shape is a compound
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isCompound() const;
/// Returns whether the shape is a compound of solids
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isCompoundOfSolids() const;
/// Returns whether the shape is a compound where all elements are topologically connected
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isConnectedTopology() const;
/// Returns whether the shape is a solid
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
virtual bool isSolid() const;
/// Returns whether the shape is a compsolid
/// Computes boundary dimensions of the shape
/// Returns False if it is not possible
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
bool computeSize(double& theXmin, double& theYmin, double& theZmin,
double& theXmax, double& theYmax, double& theZmax) const;
/// Returns the shape as BRep stream
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
std::string getShapeStream() const;
};
/// \class GeomAPI_ShapeIterator
/// \ingroup DataModel
-/// \brief Iterates on the underlying shape underlying a given GeomAPI_Shape object,
+/// \brief Iterates on the underlying shape underlying a given GeomAPI_Shape object,
/// providing access
/// to its component sub-shapes. Each component shape is returned as a GeomAPI_Shape with
/// an orientation, and a compound of the original values and the relative values.
{
public:
/// Creation by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_XY(const double theX, const double theY);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// sets X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setX(const double theX);
/// sets Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setY(const double theY);
/// result is sum of coordinates of this and the given argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XY> added(const std::shared_ptr<GeomAPI_XY>& theArg);
/// result is difference between coordinates of this and the given argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XY> decreased(const std::shared_ptr<GeomAPI_XY>& theArg);
/// result is coordinates multiplied by the argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XY> multiplied(const double theArg);
/// result is a scalar product of two triplets
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double dot(const std::shared_ptr<GeomAPI_XY>& theArg) const;
/// result is a cross product of two triplets
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double cross(const std::shared_ptr<GeomAPI_XY>& theArg) const;
/// Distance between two pairs
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_XY>& theOther) const;
};
{
public:
/// Creation by coordinates
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
GeomAPI_XYZ(const double theX, const double theY, const double theZ);
/// returns X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double x() const;
/// returns Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double y() const;
/// returns Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double z() const;
/// sets X coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setX(const double theX);
/// sets Y coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setY(const double theY);
/// sets Z coordinate
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
void setZ(const double theZ);
/// result is sum of coordinates of this and the given argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> added(const std::shared_ptr<GeomAPI_XYZ>& theArg);
/// result is difference between coordinates of this and the given argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> decreased(const std::shared_ptr<GeomAPI_XYZ>& theArg);
/// result is coordinates multiplied by the argument
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> multiplied(const double theArg);
/// result is a scalar product of two triplets
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
/// result is a cross product of two triplets
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
const std::shared_ptr<GeomAPI_XYZ> cross(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
/// Distance between two triplets
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const;
};
// Getting objects.
TopTools_ListOfShape anObjects;
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++)
{
anObjects.Append((*anObjectsIt)->impl<TopoDS_Shape>());
// Getting tools.
TopTools_ListOfShape aTools;
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++)
{
aTools.Append((*aToolsIt)->impl<TopoDS_Shape>());
void GeomAlgoAPI_Box::build()
{
myCreatedFaces.clear();
-
+
// Construct the box
BRepPrimAPI_MakeBox *aBoxMaker = new BRepPrimAPI_MakeBox(myDx, myDy, myDz);
aBoxMaker->Build();
-
+
// Test the algorithm
if (!aBoxMaker->IsDone()) {
myError = "Box builder with dimensions :: algorithm failed.";
return;
}
-
+
TopoDS_Shape aResult = aBoxMaker->Shape();
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aResult));
setShape(aShape);
-
+
// Test on the shapes
if (!aShape.get() || aShape->isNull()) {
myError = "Box builder with dimensions :: resulting shape is null.";
return;
}
-
+
setImpl(aBoxMaker);
-
+
setDone(true);
}
std::shared_ptr<GeomAPI_Shape> aShapeBack(new GeomAPI_Shape);
aShapeBack->setImpl(new TopoDS_Shape(aBoxMaker.BackFace()));
myCreatedFaces["Back"] = aShapeBack;
- std::shared_ptr<GeomAPI_Shape> aShapeTop(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShapeTop(new GeomAPI_Shape);
aShapeTop->setImpl(new TopoDS_Shape(aBoxMaker.TopFace()));
myCreatedFaces["Top"] = aShapeTop;
- std::shared_ptr<GeomAPI_Shape> aShapeBottom(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShapeBottom(new GeomAPI_Shape);
aShapeBottom->setImpl(new TopoDS_Shape(aBoxMaker.BottomFace()));
myCreatedFaces["Bottom"] = aShapeBottom;
- std::shared_ptr<GeomAPI_Shape> aShapeLeft(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShapeLeft(new GeomAPI_Shape);
aShapeLeft->setImpl(new TopoDS_Shape(aBoxMaker.LeftFace()));
myCreatedFaces["Left"] = aShapeLeft;
- std::shared_ptr<GeomAPI_Shape> aShapeRight(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShapeRight(new GeomAPI_Shape);
aShapeRight->setImpl(new TopoDS_Shape(aBoxMaker.RightFace()));
myCreatedFaces["Right"] = aShapeRight;
}
*/
class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
{
- public:
+ public:
GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
-
+
/// Creates a box using the dimensions.
/// \param theDx The dimension on X
/// \param theDy The dimension on Y
/// \param theDz The dimension on Z
GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theDx, const double theDy, const double theDz);
-
+
/// Checks if each dimension "Dx", Dy" and "Dz" for the box construction is OK.
GEOMALGOAPI_EXPORT bool check();
-
+
/// Builds the box with the dimensions "Dx", "Dy" and "Dz".
GEOMALGOAPI_EXPORT void build();
-
+
/// Prepare the naming (redifined because it is specific for a box).
GEOMALGOAPI_EXPORT void prepareNamingFaces();
-
+
private:
double myDx; /// Dimension on X to create a box.
double myDy; /// Dimension on Y to create a box.
void GeomAlgoAPI_BoxPoints::build()
{
myCreatedFaces.clear();
-
+
const gp_Pnt& aFirstPoint = myFirstPoint->impl<gp_Pnt>();
const gp_Pnt& aSecondPoint = mySecondPoint->impl<gp_Pnt>();
// Construct the box
BRepPrimAPI_MakeBox *aBoxMaker = new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint);
aBoxMaker->Build();
-
+
// Test the algorithm
if(!aBoxMaker->IsDone()) {
myError = "Box builder with two points :: algorithm failed.";
return;
}
-
+
TopoDS_Shape aResult = aBoxMaker->Shape();
-
+
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aResult));
setShape(aShape);
-
+
// Tests on the shape
if (!aShape.get() || aShape->isNull()) {
myError = "Box builder with two points :: resulting shape is null.";
return;
}
-
+
setImpl(aBoxMaker);
-
+
setDone(true);
}
*/
class GeomAlgoAPI_BoxPoints : public GeomAlgoAPI_Box
{
- public:
+ public:
/// Creates a box using the two points that defined a diagonal.
/// \param theFirstPoint One extermity of the diagonal
/// \param theSecondPoint The other extremity of the diagonal
GEOMALGOAPI_EXPORT GeomAlgoAPI_BoxPoints(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
std::shared_ptr<GeomAPI_Pnt> theSecondPoint);
-
+
/// \return true if the data of the construction of the box were correct.
GEOMALGOAPI_EXPORT bool check();
-
+
/// Builds the box.
GEOMALGOAPI_EXPORT void build();
-
+
private:
std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
static std::shared_ptr<GeomAPI_Shape> compound(
std::list<std::shared_ptr<GeomAPI_Shape> > theShapes);
- /// Produces the integerr identifier of the shape theSub in theContext (needed for
+ /// Produces the integerr identifier of the shape theSub in theContext (needed for
/// groups export to old GEOM)
/// \returns zero if theSub not found in theContext
static int id(
* \ingroup DataAlgo
* \brief Defines several static methods useful for Data Framework filling
*/
-class GEOMALGOAPI_EXPORT GeomAlgoAPI_DFLoader
+class GEOMALGOAPI_EXPORT GeomAlgoAPI_DFLoader
{
public:
/// Refine result
std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
double theDX, double theDY, double theDZ)
{
-
+
const gp_Pnt& aStart = gp_Pnt(0, 0, 0);
const gp_Pnt& anEnd = gp_Pnt(theDX, theDY, theDZ);
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc);
if (aSurf.IsNull())
return aResult;
- Handle(Geom_RectangularTrimmedSurface) aTrimmed =
+ Handle(Geom_RectangularTrimmedSurface) aTrimmed =
Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
if (!aTrimmed.IsNull())
aSurf = aTrimmed->BasisSurface();
for(int aX = 0; aX < 2; aX++) {
for(int aY = 0; aY < 2; aY++) {
for(int aZ = 0; aZ < 2; aZ++) {
- gp_XYZ aBoxVertex(aX == 0 ? aBoxMin.X() : aBoxMax.X(),
+ gp_XYZ aBoxVertex(aX == 0 ? aBoxMin.X() : aBoxMax.X(),
aY == 0 ? aBoxMin.Y() : aBoxMax.Y(), aZ == 0 ? aBoxMin.Z() : aBoxMax.Z());
gp_XYZ aVec(aBoxVertex - anAxis.Location().XYZ());
double aProjParam = aVec.Dot(anAxis.Direction().XYZ());
gp_Pnt anEnd(anAxis.Location().XYZ() - anAxis.Direction().XYZ() * 100.);
anEnd.Transform(aLoc.Transformation());
*/
-
+
BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
//=================================================================================================
const char* GeomAlgoAPI_Exception::what() const throw()
-{
+{
return myMessageError.c_str();
}
\ No newline at end of file
*/
class GeomAlgoAPI_Exception : public std::exception
{
- public:
+ public:
/// Create an exception
/// \param theMessageError Error message to be displayed
GEOMALGOAPI_EXPORT GeomAlgoAPI_Exception(std::string theMessageError);
- /// Destroyer
+ /// Destroyer
GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() throw();
- /// Allows to collet the error
+ /// Allows to collet the error
GEOMALGOAPI_EXPORT const char* what() const throw();
-
+
private:
std::string myMessageError; /// Error message to be displayed.
};
gp_Pln aPlane(aA, aB, aC, aD);
// half of the size in each direction from the center
- BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, theX, theX + theWidth,
+ BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, theX, theX + theWidth,
theY, theY + theHeight);
std::shared_ptr<GeomAPI_Face> aRes(new GeomAPI_Face());
aRes->setImpl(new TopoDS_Face(aFaceBuilder.Face()));
// Getting objects.
TopTools_ListOfShape anObjects;
- for (ListOfShape::const_iterator
+ for (ListOfShape::const_iterator
anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) {
const TopoDS_Shape& aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
if(!aShape.IsNull()) {
// Getting tools.
TopTools_ListOfShape aTools;
- for (ListOfShape::const_iterator
+ for (ListOfShape::const_iterator
aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) {
const TopoDS_Shape& aShape = (*aToolsIt)->impl<TopoDS_Shape>();
if(!aShape.IsNull()) {
for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_SOLID); anExp.More(); anExp.Next()) {
aNbVolumes ++;
}
-
+
if (aNbVolumes != 1) {
myError = theMessage +
" :: connexity error, the resulting shape is made of several separate solids.";
return false;
}
-
+
return true ;
}
-
+
/// \brief Constructor by builder and builder type.
/// \param[in] theBuilder pointer to the builder.
/// \param[in] theBuilderType builder type.
- template<class T> explicit GeomAlgoAPI_MakeShape(T* theBuilder,
+ template<class T> explicit GeomAlgoAPI_MakeShape(T* theBuilder,
const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
: GeomAPI_Interface(theBuilder),
myBuilderType(theBuilderType)
/// \brief Initializes internals.
/// \param[in] theBuilder pointer to the builder.
/// \param[in] theBuilderType builder type.
- template<class T> void initialize(T* theBuilder,
+ template<class T> void initialize(T* theBuilder,
const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
{
setImpl(theBuilder);
/// Error occurred during the execution of an algorithm.
std::string myError;
/// Map of created faces with their name for naming.
- std::map< std::string, std::shared_ptr<GeomAPI_Shape> > myCreatedFaces;
-
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > myCreatedFaces;
+
private:
/// \brief Initializes internals.
void initialize();
bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
{
- for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
+ for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
if(aMakeShape->isDeleted(theShape)) {
aResultShapesMap.Add(theShape->impl<TopoDS_Shape>());
aResultShapesList.Append(theShape->impl<TopoDS_Shape>());
- for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
+ for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
NCollection_Map<TopoDS_Shape> aTempShapes;
}
ListOfShape aModifiedShapes;
aMakeShape->modified(aShape, aModifiedShapes);
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) {
const TopoDS_Shape& anItShape = (*anIt)->impl<TopoDS_Shape>();
aTempShapes.Add(anItShape);
if(hasResults) {
const TopoDS_Shape& aTopoDSShape = aShapeIt.Value();
if(aResultShapesMap.Remove(aTopoDSShape) == Standard_True) {
- for(NCollection_List<TopoDS_Shape>::Iterator
+ for(NCollection_List<TopoDS_Shape>::Iterator
aResIt(aResultShapesList); aResIt.More(); aResIt.Next()) {
if(aTopoDSShape.IsEqual(aResIt.Value())) {
aResultShapesList.Remove(aResIt);
anAlgoShapes.Unite(aTempShapes);
}
- for(NCollection_List<TopoDS_Shape>::Iterator
+ for(NCollection_List<TopoDS_Shape>::Iterator
aShapeIt(aResultShapesList); aShapeIt.More(); aShapeIt.Next()) {
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
this->setBuilderType(OCCT_BOPAlgo_Builder);
// Getting objects.
- for (ListOfShape::const_iterator
+ for (ListOfShape::const_iterator
anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) {
const TopoDS_Shape& aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
anOperation->AddArgument(aShape);
}
// Getting tools.
- for (ListOfShape::const_iterator
+ for (ListOfShape::const_iterator
aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) {
const TopoDS_Shape& aShape = (*aToolsIt)->impl<TopoDS_Shape>();
anOperation->AddTool(aShape);
#include <TopoDS_Iterator.hxx>
//=================================================================================================
-GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape,
+GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape,
const bool theIsMakeCompSolids)
{
build(theListOfShape, theIsMakeCompSolids);
{
BOPAlgo_PaveFiller aPaveFiller;
BOPCol_ListOfShape aListOfShape;
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIt = theListOfShape.cbegin(); anIt != theListOfShape.cend(); anIt++) {
const TopoDS_Shape& aShape = (*anIt)->impl<TopoDS_Shape>();
if(aShape.ShapeType() == TopAbs_COMPOUND) {
/// \class GeomAlgoAPI_PaveFiller
/// \ingroup DataAlgo
-/// \brief Finds the common parts from the list of shapes and
+/// \brief Finds the common parts from the list of shapes and
/// breaks it to shapes with shared subshapes.
class GeomAlgoAPI_PaveFiller : public GeomAlgoAPI_MakeShape
{
/// \brief Constructor.
/// \param[in] theListOfShape list of shape which should be splitted.
/// \param[in] theIsMakeCompSolids if true gather shapes with shared faces to compsolids.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape,
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape,
const bool theIsMakeCompSolids = false);
private:
const ListOfShape& theLocations,
const GeomShapePtr thePathShape)
{
- if(theBaseShapes.empty() ||
+ if(theBaseShapes.empty() ||
(!theLocations.empty() && theLocations.size() != theBaseShapes.size())) {
return;
}
/// \class GeomAlgoAPI_Pipe
/// \ingroup DataAlgo
-/// \brief Allows to create extrusion of objects along a path.
+/// \brief Allows to create extrusion of objects along a path.
/// It produces the following results from objects:\n
/// Vertex -> Edge\n
/// Edge -> Face\n
gp_Vec(aSrcDstPoints[1 - anInd], aSrcDstPoints[anInd]));
if (aVec.SquareMagnitude() < Precision::SquareConfusion()) {
// normal and points direction are collinear
- if (Abs(aSrcDstNormals[1 - anInd].Y()) >= Precision::Confusion() ||
+ if (Abs(aSrcDstNormals[1 - anInd].Y()) >= Precision::Confusion() ||
Abs(aSrcDstNormals[1 - anInd].Z()) >= Precision::Confusion())
aVec = gp::DX();
else
gp_Vec aVec(aSrcDstPoints[anInd], aSrcDstPoints[1 - anInd]);
aVec.Cross(aSrcDstDirections[anInd]);
if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // point is on line
- if (Abs(aSrcDstDirections[1 - anInd].Y()) >= Precision::Confusion() ||
+ if (Abs(aSrcDstDirections[1 - anInd].Y()) >= Precision::Confusion() ||
Abs(aSrcDstDirections[1 - anInd].Z()) >= Precision::Confusion())
aVec = gp::DX();
else
/// \param[in] theDestSolid invariant shape
/// \param[in] theSourceShape a shape on the solid to be made coincident with destination object
/// \param[in] theDestShape destination object
- /// \param[in] theIsReverse indicates that the solid materials should be on the same side
+ /// \param[in] theIsReverse indicates that the solid materials should be on the same side
/// against the destination plane
/// \param[in] theIsCentering indicates the planes should be centered
- /// \param[in] theSimpleTransform makes just transformation of shape
+ /// \param[in] theSimpleTransform makes just transformation of shape
/// without changing of topology or geometry
GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(const std::shared_ptr<GeomAPI_Shape> theSourceSolid,
const std::shared_ptr<GeomAPI_Shape> theDestSolid,
#include <TopoDS_Vertex.hxx>
//==================================================================================================
-std::shared_ptr<GeomAPI_Vertex>
+std::shared_ptr<GeomAPI_Vertex>
GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr<GeomAPI_Pnt> thePoint)
{
const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Pnt>
+std::shared_ptr<GeomAPI_Pnt>
GeomAlgoAPI_PointBuilder::point(const std::shared_ptr<GeomAPI_Shape> theVertex)
{
TopoDS_Shape aShape = theVertex->impl<TopoDS_Shape>();
/// \brief Creates vertex by edge and distance on it.
/// \param[in] theEdge edge.
/// \param[in] theValue distance value.
- /// \param[in] theIsPercent if true theValue will be treated
+ /// \param[in] theIsPercent if true theValue will be treated
/// as a percentage of theEdge total length.
/// \param[in] theIsReverse if true the distance will be measured from the edge end point.
/// \return created vertex.
/// \param[in] theEdge linear edge.
/// \param[in] theFace planar face.
/// \return created vertex.
- static std::shared_ptr<GeomAPI_Vertex>
+ static std::shared_ptr<GeomAPI_Vertex>
vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge,
const std::shared_ptr<GeomAPI_Face> theFace);
const GeomShapePtr theFromShape,
const double theFromSize)
{
- build(theBaseShape, std::shared_ptr<GeomAPI_Dir>(), theToShape,
+ build(theBaseShape, std::shared_ptr<GeomAPI_Dir>(), theToShape,
theToSize, theFromShape, theFromSize);
}
const double theFromSize)
{
if(!theBaseShape.get() ||
- (((!theFromShape.get() && !theToShape.get()) ||
+ (((!theFromShape.get() && !theToShape.get()) ||
(theFromShape.get() && theToShape.get() && theFromShape->isEqual(theToShape)))
&& (theFromSize == -theToSize))) {
return;
// Moving base shape.
gp_Trsf aTrsf;
aTrsf.SetTranslation(aDirVec * -theFromSize);
- BRepBuilderAPI_Transform* aTransformBuilder =
+ BRepBuilderAPI_Transform* aTransformBuilder =
new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if(!aTransformBuilder) {
return;
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism* aPrismBuilder =
+ BRepPrimAPI_MakePrism* aPrismBuilder =
new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * (theFromSize + theToSize));
if(!aPrismBuilder) {
return;
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism* aPrismBuilder =
+ BRepPrimAPI_MakePrism* aPrismBuilder =
new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * 2 * aPrismLength);
if(!aPrismBuilder) {
return;
if(theType == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
IntTools_Context anIntTools;
- if(anIntTools.IsValidPointForFace(aPnt,
+ if(anIntTools.IsValidPointForFace(aPnt,
theToFace, Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
thePrismAlgo->addToShape(aGeomSh);
}
- if(anIntTools.IsValidPointForFace(aPnt,
+ if(anIntTools.IsValidPointForFace(aPnt,
theFromFace, Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
thePrismAlgo->addFromShape(aGeomSh);
/// \brief Creates extrusion for the given shape along the normal for this shape.
/// \param[in] theBaseShape vertex, edge, wire, face or shell.
- /// \param[in] theDirection direction of extrusion.
+ /// \param[in] theDirection direction of extrusion.
/// Can be empty if theBaseShape is planar wire or face.
/// \param[in] theToSize offset for "to" plane.
/// \param[in] theFromSize offset for "from" plane.
/// \brief Creates extrusion for the given shape along the normal for this shape.
/// \param[in] theBaseShape planar face or wire to be extruded.
- /// \param[in] theToShape top bounding shape. Can be empty.
+ /// \param[in] theToShape top bounding shape. Can be empty.
/// In this case offset will be applied to the basis.
/// \param[in] theToSize offset for "to" plane.
- /// \param[in] theFromShape bottom bounding shape. Can be empty.
+ /// \param[in] theFromShape bottom bounding shape. Can be empty.
/// In this case offset will be applied to the basis.
/// \param[in] theFromSize offset for "from" plane.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
/// \brief Creates extrusion for the given shape along the normal for this shape.
/// \param[in] theBaseShape planar face or wire to be extruded.
- /// \param[in] theDirection direction of extrusion.
+ /// \param[in] theDirection direction of extrusion.
/// Can be empty if theBaseShape is planar wire or face.
/// \param[in] theToShape top bounding shape. Can be empty.
/// In this case offset will be applied to the basis.
const double theFromAngle)
{
if(!theBaseShape || !theAxis ||
- (((!theFromShape && !theToShape) ||
+ (((!theFromShape && !theToShape) ||
(theFromShape && theToShape && theFromShape->isEqual(theToShape)))
&& (theFromAngle == -theToAngle))) {
return;
}
} else if(theFromShape && theToShape) { // Case 2: When both bounding planes were set.
// Making revolution to the 360 angle.
- BRepPrimAPI_MakeRevol* aRevolBuilder =
+ BRepPrimAPI_MakeRevol* aRevolBuilder =
new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True);
if(!aRevolBuilder) {
return;
// Rotating bounding planes to the specified angle.
gp_Trsf aFromTrsf;
gp_Trsf aToTrsf;
- double aFromRotAngle =
- ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theFromAngle :
+ double aFromRotAngle =
+ ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theFromAngle :
theFromAngle;
- double aToRotAngle =
+ double aToRotAngle =
((aToPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theToAngle :
theToAngle;
aFromTrsf.SetRotation(anAxis,aFromRotAngle / 180.0 * M_PI);
aResult = aGeomShape->impl<TopoDS_Shape>();
}
- // If after cut we got more than one solids then take closest
+ // If after cut we got more than one solids then take closest
// to the center of mass of the base face.
aResult = findClosest(aResult, aBaseCentre);
}
} else { //Case 3: When only one bounding plane was set.
// Making revolution to the 360 angle.
- BRepPrimAPI_MakeRevol* aRevolBuilder =
+ BRepPrimAPI_MakeRevol* aRevolBuilder =
new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True);
if(!aRevolBuilder) {
return;
aResult = aGeomShape->impl<TopoDS_Shape>();
}
- // If after cut we got more than one solids then take
+ // If after cut we got more than one solids then take
// closest to the center of mass of the base face.
aResult = findClosest(aResult, aBaseCentre);
// Setting naming.
if(aShapeTypeToExp == TopAbs_COMPOUND) {
- storeGenerationHistory(this, aResult, TopAbs_EDGE,
+ storeGenerationHistory(this, aResult, TopAbs_EDGE,
aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet);
- storeGenerationHistory(this, aResult, TopAbs_FACE,
+ storeGenerationHistory(this, aResult, TopAbs_FACE,
aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet);
} else {
- storeGenerationHistory(this, aResult, aShapeTypeToExp,
+ storeGenerationHistory(this, aResult, aShapeTypeToExp,
aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet);
}
}
if(theType == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
IntTools_Context anIntTools;
- if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace),
+ if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
} else if(theType == TopAbs_EDGE) {
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
anEdgeCheck.Init(anEdge, TopoDS::Face(theModifiedBaseShape));
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
} else {
Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aShape));
- Handle(Geom_Surface) aBoundingSurface =
+ Handle(Geom_Surface) aBoundingSurface =
BRep_Tool::Surface(TopoDS::Face(theRotatedBoundingFace));
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape));
if(aFaceSurface == aBoundingSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
if(aFaceSurface == aBaseSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
- theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
+ theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
}
/// \brief Creates revolution for the given shape.
/// \param[in] theBaseShape face for revolution.
/// \param[in] theAxis axis for revolution.
- /// \param[in] theToShape to bounding shape. Can be empty.
+ /// \param[in] theToShape to bounding shape. Can be empty.
/// In this case offset will be applied to the basis.
/// \param[in] theToAngle to angle.
- /// \param[in] theFromShape from bounding shape. Can be empty.
+ /// \param[in] theFromShape from bounding shape. Can be empty.
/// In this case offset will be applied to the basis.
/// \param[in] theFromAngle from angle.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape,
/// \class GeomAlgoAPI_Sewing
/// \ingroup DataAlgo
-/// \brief Allows creation of connected topology (shells)
+/// \brief Allows creation of connected topology (shells)
/// from a set of separate topological elements (faces).
class GeomAlgoAPI_Sewing : public GeomAlgoAPI_MakeShape
{
const double theDz) throw (GeomAlgoAPI_Exception)
{
GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz);
-
+
if (!aBoxAlgo.check()) {
throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
}
-
+
aBoxAlgo.build();
-
+
if(!aBoxAlgo.isDone()) {
throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
}
}
return aBoxAlgo.shape();
}
-
+
//======================================================================================
std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception)
{
GeomAlgoAPI_BoxPoints aBoxAlgo(theFirstPoint, theSecondPoint);
-
+
if (!aBoxAlgo.check()) {
throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
}
-
+
aBoxAlgo.build();
-
+
if(!aBoxAlgo.isDone()) {
throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
}
/// \param theDy The dimension on Y
/// \param theDz The dimension on Z
/// \return a shape
- static std::shared_ptr<GeomAPI_Shape> makeBox(const double theDx, const double theDy,
+ static std::shared_ptr<GeomAPI_Shape> makeBox(const double theDx, const double theDy,
const double theDz) throw (GeomAlgoAPI_Exception);
-
+
/// Creates a box using the two points that defined a diagonal.
/// \param theFirstPoint One extermity of the diagonal
/// \param theSecondPoint The other extremity of the diagonal
// Copy sub-shapes from list to new shape.
BRep_Builder aBuilder;
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom());
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIt = theShapesToAdd.cbegin(); anIt != theShapesToAdd.cend(); ++anIt) {
TopoDS_Shape aShapeToAdd = (*anIt)->impl<TopoDS_Shape>();
TopoDS_Shape aModShapeToAdd = aShapeToAdd;
if(aBaseShapeType == TopAbs_WIRE) {
if(aShapeToAddType == TopAbs_VERTEX) {
// Find on which edge vertex is lie and add to this edge.
- for(TopExp_Explorer
+ for(TopExp_Explorer
aResultExp(aResultShape, TopAbs_EDGE); aResultExp.More(); aResultExp.Next()) {
TopoDS_Shape anEdge = aResultExp.Current();
BRepExtrema_DistShapeShape aDist(anEdge, aShapeToAdd);
// Get all shapes with common subshapes and free shapes.
NCollection_Map<TopoDS_Shape> aFreeShapes;
NCollection_Vector<NCollection_Map<TopoDS_Shape>> aShapesWithCommonSubshapes;
- for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator
+ for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator
anIter(aMapSA); anIter.More(); anIter.Next()) {
const TopoDS_Shape& aShape = anIter.Key();
BOPCol_ListOfShape& aListOfShape = anIter.ChangeValue();
aFreeShapes.Remove(aF);
aFreeShapes.Remove(aL);
aListOfShape.Clear();
- for(NCollection_List<TopoDS_Shape>::Iterator
+ for(NCollection_List<TopoDS_Shape>::Iterator
aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) {
const TopoDS_Shape& aTempShape = aTempIter.Value();
- for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator
+ for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator
anIter(aMapSA); anIter.More(); anIter.Next()) {
BOPCol_ListOfShape& aTempListOfShape = anIter.ChangeValue();
if(aTempListOfShape.IsEmpty()) {
}
// Combine shapes with common subshapes.
- for(NCollection_Vector<NCollection_Map<TopoDS_Shape>>::Iterator
+ for(NCollection_Vector<NCollection_Map<TopoDS_Shape>>::Iterator
anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) {
TopoDS_Shell aShell;
TopoDS_CompSolid aCSolid;
TopoDS_Builder aBuilder;
- theType ==
+ theType ==
GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell);
NCollection_Map<TopoDS_Shape>& aShapesMap = anIter.ChangeValue();
for(TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) {
const TopoDS_Shape& aShape = anExp.Current();
if(aShapesMap.Contains(aShape)) {
- theType ==
+ theType ==
GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape);
aShapesMap.Remove(aShape);
}
}
std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
- TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) :
+ TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) :
new TopoDS_Shape(aShell);
aGeomShape->setImpl<TopoDS_Shape>(aSh);
theCombinedShapes.push_back(aGeomShape);
TopoDS_Compound aResultComp;
TopoDS_Builder aBuilder;
aBuilder.MakeCompound(aResultComp);
- for(ListOfShape::const_iterator anIter = theCombinedShapes.cbegin();
+ for(ListOfShape::const_iterator anIter = theCombinedShapes.cbegin();
anIter != theCombinedShapes.cend(); anIter++) {
aBuilder.Add(aResultComp, (*anIter)->impl<TopoDS_Shape>());
}
- for(ListOfShape::const_iterator anIter = theFreeShapes.cbegin();
+ for(ListOfShape::const_iterator anIter = theFreeShapes.cbegin();
anIter != theFreeShapes.cend(); anIter++) {
aBuilder.Add(aResultComp, (*anIter)->impl<TopoDS_Shape>());
}
}
//==================================================================================================
-static void addSimpleShapeToList(const TopoDS_Shape& theShape,
+static void addSimpleShapeToList(const TopoDS_Shape& theShape,
NCollection_List<TopoDS_Shape>& theList)
{
if(theShape.IsNull()) {
NCollection_List<TopoDS_Shape> aGroupedShapes;
aGroupedShapes.Append(anUngroupedShapes.First());
anUngroupedShapes.RemoveFirst();
- for(NCollection_List<TopoDS_Shape>::Iterator aGroupIt(aGroupedShapes);
+ for(NCollection_List<TopoDS_Shape>::Iterator aGroupIt(aGroupedShapes);
aGroupIt.More(); aGroupIt.Next()) {
const TopoDS_Shape& aGroupShape = aGroupIt.Value();
- for(NCollection_List<TopoDS_Shape>::Iterator anUngroupedIt(anUngroupedShapes);
+ for(NCollection_List<TopoDS_Shape>::Iterator anUngroupedIt(anUngroupedShapes);
anUngroupedIt.More(); anUngroupedIt.Next()) {
const TopoDS_Shape& anUngroupedShape = anUngroupedIt.Value();
bool isFound = false;
- for(TopExp_Explorer aGroupShapeExp(aGroupShape, TopAbs_VERTEX);
+ for(TopExp_Explorer aGroupShapeExp(aGroupShape, TopAbs_VERTEX);
aGroupShapeExp.More(); aGroupShapeExp.Next()) {
const TopoDS_Shape& aVertex1 = aGroupShapeExp.Current();
- for(TopExp_Explorer anUngroupedShapeExp(anUngroupedShape, TopAbs_VERTEX);
+ for(TopExp_Explorer anUngroupedShapeExp(anUngroupedShape, TopAbs_VERTEX);
anUngroupedShapeExp.More(); anUngroupedShapeExp.Next()) {
const TopoDS_Shape& aVertex2 = anUngroupedShapeExp.Current();
if(aVertex1.IsSame(aVertex2)) {
BRep_Builder aBuilder;
aBuilder.MakeCompound(aCompound);
ListOfShape aCompSolids, aFreeSolids;
- for(NCollection_Vector<NCollection_List<TopoDS_Shape>>::Iterator
+ for(NCollection_Vector<NCollection_List<TopoDS_Shape>>::Iterator
anIt(aGroups); anIt.More(); anIt.Next()) {
NCollection_List<TopoDS_Shape> aGroup = anIt.Value();
GeomShapePtr aGeomShape(new GeomAPI_Shape());
Bnd_Box aBndBox;
// Getting box.
- for (ListOfShape::const_iterator
+ for (ListOfShape::const_iterator
anObjectsIt = theShapes.begin(); anObjectsIt != theShapes.end(); anObjectsIt++) {
const TopoDS_Shape& aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
BRepBndLib::Add(aShape, aBndBox);
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Shape>
+std::shared_ptr<GeomAPI_Shape>
GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape> theFace)
{
if (!theFace.get())
IntAna_Quadric aQuadric(aFacePln);
Standard_Real UMin, UMax, VMin, VMax;
UMin = UMax = VMin = VMax = 0;
- for (std::list<std::shared_ptr<GeomAPI_Pnt> >::const_iterator
+ for (std::list<std::shared_ptr<GeomAPI_Pnt> >::const_iterator
aPointsIt = thePoints.begin(); aPointsIt != thePoints.end(); aPointsIt++) {
const gp_Pnt& aPnt = (*aPointsIt)->impl<gp_Pnt>();
gp_Lin aLin(aPnt, aFacePln.Axis().Direction());
// No intersections found. Edge is inside or outside face. Check it.
BRepAdaptor_Curve aCurveAdaptor(anEdge);
gp_Pnt aPointToCheck =
- aCurveAdaptor.Value((aCurveAdaptor.FirstParameter() +
+ aCurveAdaptor.Value((aCurveAdaptor.FirstParameter() +
aCurveAdaptor.LastParameter()) / 2.0);
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
ShapeAnalysis_Surface aSAS(aSurface);
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Shape>
+std::shared_ptr<GeomAPI_Shape>
GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace)
{
GeomShapePtr anOuterWire;
aBOP.Perform();
if (aBOP.ErrorStatus())
return;
-
+
// Collect splits
const TopTools_ListOfShape& aSplits = aBOP.Modified(aBaseEdge);
TopTools_ListIteratorOfListOfShape anIt(aSplits);
/// \return the total volume of the solids of the current shape or 0.0 if it can be computed.
GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr<GeomAPI_Shape> theShape);
- /// \return the centre of mass of the current face.
+ /// \return the centre of mass of the current face.
/// The coordinates returned for the center of mass
- /// are expressed in the absolute Cartesian coordinate system.
+ /// are expressed in the absolute Cartesian coordinate system.
/// (This function works only for surfaces).
- GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Pnt>
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Pnt>
centreOfMass(const std::shared_ptr<GeomAPI_Shape> theShape);
/// \brief Combines faces with common edges to shells, or solids to compsolids.
/// \brief Groups shapes with shared topology to compounds.
/// \param[in] theCompound compound of shapes.
/// \return compound of compounds with shared topology.
- GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape>
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape>
groupSharedTopology(const std::shared_ptr<GeomAPI_Shape> theCompound);
/// \brief Calculates bounding box for theShapes
/// \return list of eight points.
/// \param[in] theShapes list of shapes.
/// \param[in] theEnlarge enlarges bounding box size.
- GEOMALGOAPI_EXPORT static
- std::list<std::shared_ptr<GeomAPI_Pnt> > getBoundingBox(const ListOfShape& theShapes,
+ GEOMALGOAPI_EXPORT static
+ std::list<std::shared_ptr<GeomAPI_Pnt> > getBoundingBox(const ListOfShape& theShapes,
const double theEnlarge = 0.0);
/// \return infinite plane received from theFace plane.
- GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape>
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape>
faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape> theFace);
/// \brief Enlarges or reduces plane to fit bounding box.
GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape);
/// \return outer wire for face. If theShape has different type returns empty pointer.
- GEOMALGOAPI_EXPORT static
+ GEOMALGOAPI_EXPORT static
std::shared_ptr<GeomAPI_Shape> getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace);
/// \return true if edge is parallel to face.
const std::shared_ptr<GeomAPI_Shape>& theWire,
std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
{
- std::shared_ptr<GeomAPI_PlanarEdges> aWire =
+ std::shared_ptr<GeomAPI_PlanarEdges> aWire =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
if(aWire) {
// Filter wires, return only faces.
public:
/// \brief Creates a wire from edges and wires.
/// \param[in] theShapes list of shapes. Only edges and wires allowed.
- /// The edges are not to be consecutive.
+ /// The edges are not to be consecutive.
/// But they are to be all connected geometrically or topologically.
/// \return wire created from theShapes. Empty in case of error or bad input.
GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> wire(const ListOfShape& theShapes);
class GeomData_Point : public GeomDataAPI_Point
{
enum { NUM_COMPONENTS = 3 };
- /// Expressions for X, Y and Z
- std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS];
+ /// Expressions for X, Y and Z
+ std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS];
public:
/// Defines the double value
GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
/// Defines the calculated double value
- GEOMDATA_EXPORT virtual
+ GEOMDATA_EXPORT virtual
void setCalculatedValue(const double theX, const double theY, const double theZ);
/// Defines the text values
GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
/// Defines the used parameters
- GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
+ GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
const std::set<std::string>& theUsedParameters);
/// Returns the used parameters
return myExpression[theComponent]->error();
}
-void GeomData_Point2D::setUsedParameters(int theComponent,
+void GeomData_Point2D::setUsedParameters(int theComponent,
const std::set<std::string>& theUsedParameters)
{
assert(theComponent >= 0 && theComponent < NUM_COMPONENTS);
GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
/// Defines the used parameters
- GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
+ GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
const std::set<std::string>& theUsedParameters);
/// Returns the used parameters
{
public:
/// Defines the double value
- GEOMDATAAPI_EXPORT virtual
+ GEOMDATAAPI_EXPORT virtual
void setValue(const double theX, const double theY, const double theZ) = 0;
/// Defines the point
GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint) = 0;
GEOMDATAAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt() = 0;
/// Defines the calculated double value
- GEOMDATAAPI_EXPORT virtual
+ GEOMDATAAPI_EXPORT virtual
void setCalculatedValue(const double theX, const double theY, const double theZ) = 0;
-
+
/// Defines the text values
GEOMDATAAPI_EXPORT virtual void setText(const std::string& theX,
const std::string& theY,
GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
/// Allows to set expression (text) error (by the parameters listener)
- GEOMDATAAPI_EXPORT virtual
+ GEOMDATAAPI_EXPORT virtual
void setExpressionError(int theComponent, const std::string& theError) = 0;
/// Returns an expression error
GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
/// Defines the used parameters
- GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
+ GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
/// Allows to set expression (text) error (by the parameters listener)
- GEOMDATAAPI_EXPORT virtual
+ GEOMDATAAPI_EXPORT virtual
void setExpressionError(int theComponent, const std::string& theError) = 0;
/// Returns an expression error
GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
/// Defines the used parameters
- GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
+ GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
}
//=================================================================================================
-bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature,
+bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
if(theAttribute == "main_objects" || theAttribute == "tool_objects") {
Events_InfoMessage& theError) const;
/// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
+ GEOMVALIDATORS_EXPORT virtual
bool isNotObligatory(std::string theFeature, std::string theAttribute);
};
GeomShapePtr aShape = aSelectionAttr->value();
GeomShapePtr aShapePtr = aResult->shape();
// it is important to call isEqual of the shape of result.
- // It is a GeomAPI_Vertex shape for the point. The shape of the parameter is
+ // It is a GeomAPI_Vertex shape for the point. The shape of the parameter is
// GeomAPI_Shape. It is important to use the realization of the isEqual method from
// GeomAPI_Vertex class
if (!aShape.get()) {
bool isEqualAttributes(const AttributePtr& theLeft, const AttributePtr& theRight)
{
- if (theLeft->attributeType() == GeomDataAPI_Point2D::typeId() &&
+ if (theLeft->attributeType() == GeomDataAPI_Point2D::typeId() &&
theRight->attributeType() == GeomDataAPI_Point2D::typeId())
return isEqual(std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theLeft),
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theRight));
Events_InfoMessage& theError) const
{
std::map<std::string, std::list<AttributePtr> > anAttributesMap;
- // For all attributes referred by theArguments
- // sort it using attributeType() and store into anAttributesMap
+ // For all attributes referred by theArguments
+ // sort it using attributeType() and store into anAttributesMap
std::list<std::string>::const_iterator anArgumentIt = theArguments.begin();
for (; anArgumentIt != theArguments.end(); ++anArgumentIt) {
AttributePtr anAttribute = theFeature->attribute(*anArgumentIt);
}
// Search differences inside each attribute list
- std::map<std::string, std::list<AttributePtr> >::const_iterator
+ std::map<std::string, std::list<AttributePtr> >::const_iterator
anAttributesMapIt = anAttributesMap.begin();
for (; anAttributesMapIt != anAttributesMap.end(); ++anAttributesMapIt) {
const std::list<AttributePtr>& anAttributes = anAttributesMapIt->second;
std::list<AttributePtr>::const_iterator aFindIt =
std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt));
if (aFindIt != anAttributes.end()) {
- theError = "Attributes " + (*anAttributeIt)->id() + " and " +
+ theError = "Attributes " + (*anAttributeIt)->id() + " and " +
(*aFindIt)->id() + " are equal." ;
return false;
}
++anAttributeIt;
- ++aNextIt;
+ ++aNextIt;
}
}
}
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const;
- GEOMVALIDATORS_EXPORT virtual
+ GEOMVALIDATORS_EXPORT virtual
bool isNotObligatory(std::string theFeature, std::string theAttribute);
};
Events_InfoMessage& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeSelectionPtr aSelectionAttribute =
+ AttributeSelectionPtr aSelectionAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
GeomShapePtr aShape = aSelectionAttribute->value();
if (!aShape.get()) {
std::string aCurrentAttributeId = theAttribute->id();
// get all feature attributes
- std::list<AttributePtr> anAttrs =
+ std::list<AttributePtr> anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
if (anAttrs.size() > 0 && aShape.get() != NULL) {
std::list<AttributePtr>::iterator anAttr = anAttrs.begin();
AttributePtr anAttribute = *anAttr;
// take into concideration only other attributes
if (anAttribute.get() != NULL && anAttribute->id() != aCurrentAttributeId) {
- aSelectionAttribute =
+ aSelectionAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
// the shape of the attribute should be not the same
if (aSelectionAttribute.get() != NULL) {
std::string aType = std::string(theType.c_str());
if (MyFaceTypes.find(aType) != MyFaceTypes.end())
return MyFaceTypes[aType];
-
+
Events_InfoMessage("GeomValidators_Face", "Face type defined in XML is not implemented!").send();
return GeomAbs_Plane;
}
std::string anAttributeType = theAttribute->attributeType();
if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aSelectionListAttr =
+ AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
// all context objects should be sketch entities
for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize && isSketchEntities; i++) {
}
}
if (anAttributeType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr aSelectAttr =
+ AttributeSelectionPtr aSelectAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ObjectPtr anObject = aSelectAttr->context();
// a context of the selection attribute is a feature result. It can be a case when the result
}
}
if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
- std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
isSketchEntities = false;
if (aRef->isObject()) {
}
}
if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr aRefAttr =
+ AttributeReferencePtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr anObject = aRefAttr->value();
// a context of the selection attribute is a feature result. It can be a case when the result
const std::string anAttributeType = theAttribute->attributeType();
if(anAttributeType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr aSelectionAttr =
+ AttributeSelectionPtr aSelectionAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ResultPtr aResult = aSelectionAttr->context();
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (aConstruction.get() && aConstruction->isInfinite()) {
aValid = false;
theError = "Infinite result is selected.";
}
} else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aSelectionListAttr =
+ AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) {
AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
ResultPtr aResult = aSelectAttr->context();
if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (aConstruction.get() && aConstruction->isInfinite()) {
aValid = false;
return false;
}
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeSelectionListPtr anAttrSelectionList =
+ AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) {
AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex);
Events_InfoMessage& theError) const
{
if(theArguments.size() != 2) {
- theError =
+ theError =
"Error: Wrong number of arguments (expected 2): selection list id and min number of objects";
return false;
}
}
//================================================================================================
-bool GeomValidators_MinObjectsSelected::isNotObligatory(std::string theFeature,
+bool GeomValidators_MinObjectsSelected::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
return false;
isCombine = anAttrBool->value();
}
- if((anObjectsNb > 0 && aToolsNb > 0) ||
+ if((anObjectsNb > 0 && aToolsNb > 0) ||
(isCombine && anObjectsNb != 0 && (anObjectsNb + aToolsNb > 1))) {
return true;
}
}
//=================================================================================================
-bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
+bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
if(theAttribute == "tool_objects") {
Events_InfoMessage& theError) const;
/// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
+ GEOMVALIDATORS_EXPORT virtual
bool isNotObligatory(std::string theFeature, std::string theAttribute);
};
new GeomValidators_PartitionArguments);
aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset);
- aFactory->registerValidator("GeomValidators_IntersectionSelection",
+ aFactory->registerValidator("GeomValidators_IntersectionSelection",
new GeomValidators_IntersectionSelection);
aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind);
- aFactory->registerValidator("GeomValidators_MinObjectsSelected",
+ aFactory->registerValidator("GeomValidators_MinObjectsSelected",
new GeomValidators_MinObjectsSelected);
// register this plugin
aFactory->registerValidator("GeomValidators_Positive", this);
}
-bool GeomValidators_Positive::isValid(const AttributePtr& theAttribute,
+bool GeomValidators_Positive::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
typedef std::map<std::string, GeomValidators_ShapeType::TypeOfShape> EdgeTypes;
static EdgeTypes MyShapeTypes;
-GeomValidators_ShapeType::TypeOfShape
+GeomValidators_ShapeType::TypeOfShape
GeomValidators_ShapeType::shapeType(const std::string& theType)
{
if (MyShapeTypes.size() == 0) {
std::string aValue = "";
if (MyShapeTypes.size() != 0) {
- std::map<std::string, GeomValidators_ShapeType::TypeOfShape>::const_iterator
+ std::map<std::string, GeomValidators_ShapeType::TypeOfShape>::const_iterator
anIt = MyShapeTypes.begin(), aLast = MyShapeTypes.end();
for (; anIt != aLast; anIt++) {
if (anIt->second == theType)
std::string anAttributeType = theAttribute->attributeType();
if (anAttributeType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
GeomShapePtr aShape = anAttr->value();
if (aShape.get())
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if( theShapeType==Plane )
{
- ResultConstructionPtr aResultConstruction =
+ ResultConstructionPtr aResultConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
const std::string& aKind = aFeature->getKind();
ObjectPtr anObject;
std::string anAttrType = theAttribute->attributeType();
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr =
+ AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anAttr != NULL && anAttr->isObject())
anObject = anAttr->object();
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
if (anAttr != NULL)
anObject = anAttr->context();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr =
+ AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
if (anAttr.get() != NULL)
anObject = anAttr->value();
namespace GeomValidators_Tools
{
// Returns the object from the attribute
- /// \param theObj an object
+ /// \param theObj an object
GEOMVALIDATORS_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute);
};
ListOfShape aFacesList;
if(theFeature->selection(*anIt)) {
AttributeSelectionPtr aFaceSelection = theFeature->selection(*anIt);
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFaceSelection->context());
if(aConstruction.get()) {
int aSketchFacesNum = aConstruction->facesNum();
for(int aFaceIndex = 0; aFaceIndex < aSketchFacesNum; aFaceIndex++) {
- std::shared_ptr<GeomAPI_Shape> aFace =
+ std::shared_ptr<GeomAPI_Shape> aFace =
std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
if(aFace->isFace() && aFace->isPlanar()) {
aFacesList.push_back(aFace);
if(!aContextShape.get()) {
break;
}
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(!aConstruction.get()) {
break;
}
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
if(aPln.get()) {
- for(ListOfShape::const_iterator
+ for(ListOfShape::const_iterator
anIter = aFacesList.cbegin(); anIter != aFacesList.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aSketchShape = *anIter;
std::shared_ptr<GeomAPI_Face> aSketchFace(new GeomAPI_Face(aSketchShape));
Events_InfoMessage& theError) const;
/// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
+ GEOMVALIDATORS_EXPORT virtual
bool isNotObligatory(std::string theFeature, std::string theAttribute);
};
aAxis->data()->setName("OZ");
}
// don't show automatically created feature in the features history
- aAxis->setInHistory(aAxis, false);
+ aAxis->setInHistory(aAxis, false);
aAxis->execute();
aAxis->data()->execState(ModelAPI_StateDone);
aAxis->firstResult()->data()->execState(ModelAPI_StateDone);
/// \param theX - X coordinate
/// \param theY - Y coordinate
/// \param theZ - Z coordinate
- FeaturePtr createPoint(DocumentPtr theDoc, const std::string& theName,
+ FeaturePtr createPoint(DocumentPtr theDoc, const std::string& theName,
double theX, double theY, double theZ);
/// Creates an axis which is started from origin point
/// \param theX - X of direction point
/// \param theY - Y of direction point
/// \param theZ - Z of direction point
- FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin,
+ FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin,
double theX, double theY, double theZ);
};
#ifndef Model_Application_H_
#define Model_Application_H_
-#include <Model_Document.h>
+#include <Model_Document.h>
#include <TDocStd_Application.hxx>
#include <map>
-// Define handle class
+// Define handle class
DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
/**\class Model_Application
/// \param Model_Application is the class name that is covered by the OCCT Handle
DEFINE_STANDARD_RTTI(Model_Application);
- //! Retuns the application: one per process
+ //! Retuns the application: one per process
MODEL_EXPORT static Handle_Model_Application getApplication();
//! Returns the document by the identifier
//! \returns false of document is not yet created/not loaded
//! \param theFormats sequence of allowed formats for input/output
virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);
//! Constructor
- //! Use method GetInstance() method to obtain
+ //! Use method GetInstance() method to obtain
//! the static instance of the object (or derive your own application)
Model_Application();
class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
{
/// persistent and unique identifier of the document in the application
- Handle(TDataStd_Integer) myID;
+ Handle(TDataStd_Integer) myID;
public:
/// Defines the document referenced from this attribute
void Model_AttributeIntArray::reinit()
{
// check the attribute could be already presented in this doc (after load document)
- myIsInitialized =
+ myIsInitialized =
myLab.FindAttribute(TDataStd_IntegerArray::GetID(), myArray) == Standard_True;
}
class Model_AttributeIntArray : public ModelAPI_AttributeIntArray
{
- /// The OCCT array that keeps all values.
+ /// The OCCT array that keeps all values.
Handle_TDataStd_IntegerArray myArray;
/// Stores the label as a field to set array if size is not null (null array is buggy in OCAF)
TDF_Label myLab;
void Model_AttributeRefAttrList::append(AttributePtr theAttr)
{
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data());
myRef->Append(aData->label().Father()); // store label of the object
myIDs->Append(theAttr->id().c_str()); // store the ID of the referenced attribute
if (theObject.get() != NULL) {
aTheObjLab = std::dynamic_pointer_cast<Model_Data>(theObject->data())->label().Father();
}
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
// remove from the both lists by clearing the list and then appending one by one
// TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal
if (theAttr->owner().get() != NULL) {
aTheObjLab = std::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data())->label().Father();
}
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
// remove from the both lists by clearing the list and then appending one by one
// TODO: in OCCT 7.0 there are methods for removing by index, seems will be more optimal
TDF_ListIteratorOfLabelList aRefIter(aRefList);
TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList);
for (; aRefIter.More(); aRefIter.Next(), anIDIter.Next()) {
- if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() ||
+ if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() ||
// append now only not removed
aRefIter.Value() != aTheObjLab || // append now only not removed
(aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL)) {
ObjectPtr anObj;
if (!aLIter.Value().IsNull()) {
anObj = aDoc->objects()->object(aLIter.Value());
- aResult.push_back(std::pair<ObjectPtr, AttributePtr>(anObj,
+ aResult.push_back(std::pair<ObjectPtr, AttributePtr>(anObj,
anObj->data()->attribute(TCollection_AsciiString(anIDIter.Value()).ToCString())));
} else {
aResult.push_back(std::pair<ObjectPtr, AttributePtr>(ObjectPtr(), AttributePtr()));
std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc) {
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data());
if (aData.get() && aData->isValid()) {
TDF_Label anObjLab = aData->label().Father();
}
ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& theLIter,
- TDataStd_ListIteratorOfListOfExtendedString& theExtIter,
+ TDataStd_ListIteratorOfListOfExtendedString& theExtIter,
std::shared_ptr<Model_Document> theDoc) const
{
ObjectPtr anObj;
ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty) const
{
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
if (aDoc) {
int anIndex = -1;
TDF_Label aCurrentLab = aData->label().Father();
TDF_Label aNewLab;
if (theNew.get() && theNew->data()->isValid()) { // the new may be null
- std::shared_ptr<Model_Data> aNewData =
+ std::shared_ptr<Model_Data> aNewData =
std::dynamic_pointer_cast<Model_Data>(theNew->data());
aNewLab = aNewData->label().Father();
} else {
if (aData1.get() && aData1->isValid()) {
TDF_Label aLab1 = aData1->label().Father();
if (theObject2.get() && theObject2->data()->isValid()) { // the new may be null
- std::shared_ptr<Model_Data> aData2 =
+ std::shared_ptr<Model_Data> aData2 =
std::dynamic_pointer_cast<Model_Data>(theObject2->data());
if (aData2.get() && aData2->isValid()) {
TDF_Label aLab2 = aData2->label().Father();
if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) {
std::shared_ptr<Model_Document> aDR = std::dynamic_pointer_cast<Model_Document>(aRefDoc);
TDF_Label aRefLab;
- TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
+ TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
anEntry->Get().ToCString(), aRefLab);
if (!aRefLab.IsNull()) {
return aDR->objects()->object(aRefLab);
if (theContext->groupName() == ModelAPI_ResultBody::group()) {
// do not select the whole shape for body:it is already must be in the data framework
// equal and null selected objects mean the same: object is equal to context,
- if (theContext->shape().get() &&
+ if (theContext->shape().get() &&
(theContext->shape()->isEqual(theSubShape) || !theSubShape.get())) {
aSelLab.ForgetAllAttributes(true);
TDataStd_UAttribute::Set(aSelLab, kSIMPLE_REF_ID);
// to sub, so the whole result is selected
aSelLab.ForgetAllAttributes(true);
TDataStd_UAttribute::Set(aSelLab, kCONSTUCTION_SIMPLE_REF_ID);
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
if (aConstruction->isInfinite()) {
// For correct naming selection, put the shape into the naming structure.
// It seems sub-shapes are not needed: only this shape is (and can be ) selected.
TNaming_Builder aBuilder(aSelLab);
aBuilder.Generated(theContext->shape()->impl<TopoDS_Shape>());
- std::shared_ptr<Model_Document> aMyDoc =
+ std::shared_ptr<Model_Document> aMyDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
//std::string aName = contextName(theContext);
// for selection in different document, add the document name
if (myRef.isInitialized()) {
if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape
ResultPtr aContext = context();
- if (!aContext.get())
+ if (!aContext.get())
return aResult; // empty result
return aContext->shape();
}
aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
aResult->setImpl(new TopoDS_Shape(aSelShape));
} else { // for simple construction element: just shape of this construction element
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(context());
if (aConstr) {
return aConstr->shape();
ResultPtr aContext = context();
return aContext.get() != NULL;
}
- if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) {
+ if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) {
// it is just reference to construction, nothing is in value
return true;
}
if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
return !aSelection->Get().IsNull();
} else { // for simple construction element: just shape of this construction element
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(context());
if (aConstr.get()) {
return aConstr->shape().get() != NULL;
std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures = aMyDoc->allFeatures();
std::list<std::shared_ptr<ModelAPI_Feature> >::iterator aFIter = allFeatures.begin();
bool aMePassed = false;
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(owner());
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
CompositeFeaturePtr aCompositeOwner, aCompositeOwnerOwner;
}
if (isGroup) aMePassed = false;
bool isInScope = !aMePassed;
- if (!isInScope && aComposite.get()) {
+ if (!isInScope && aComposite.get()) {
// try to add sub-elements of composite if this is composite
if (aComposite->isSub(*aFIter))
isInScope = true;
{
TDF_Label aSelLab = selectionLabel();
ResultPtr aContext = context();
- if (!aContext.get())
+ if (!aContext.get())
return setInvalidIfFalse(aSelLab, false);
if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape
return setInvalidIfFalse(aSelLab, aContext->shape() && !aContext->shape()->isNull());
}
- if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) {
+ if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) {
// it is just reference to construction, not sub-shape
// if there is a sketch, the sketch-naming must be updated
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if (!aConstruction->isInfinite()) {
BRep_Builder aCompoundBuilder;
// It seems sub-shapes are not needed: only this shape is (and can be ) selected.
TNaming_Builder aBuilder(aSelLab);
aBuilder.Generated(aContext->shape()->impl<TopoDS_Shape>());
- std::shared_ptr<Model_Document> aMyDoc =
+ std::shared_ptr<Model_Document> aMyDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
//std::string aName = contextName(aContext);
//aMyDoc->addNamingName(aSelLab, aName);
} else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
// construction: identification by the results indexes, recompute faces and
// take the face that more close by the indexes
- ResultConstructionPtr aConstructionContext =
+ ResultConstructionPtr aConstructionContext =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
FeaturePtr aContextFeature = aContext->document()->feature(aContext);
// sketch sub-element
- if (aConstructionContext &&
+ if (aConstructionContext &&
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature).get())
{
TDF_Label aLab = myRef.myRef->Label();
// selected indexes will be needed in each "if"
Handle(TDataStd_IntPackedMap) aSubIds;
std::shared_ptr<GeomAPI_Shape> aNewSelected;
- bool aNoIndexes =
+ bool aNoIndexes =
!aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), aSubIds) || aSubIds->Extent() == 0;
// for now working only with composite features
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
if (!aComposite.get() || aComposite->numberOfSubs() == 0) {
return setInvalidIfFalse(aSelLab, false);
}
- if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) {
+ if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) {
// compound is for the whole sketch selection
// If this is a wire with plane defined then it is a sketch-like object
if (!aConstructionContext->facesNum()) // no faces, update can not work correctly
} else { // searching for most looks-like initial face by the indexes
// prepare edges of the current result for the fast searching
// curves and orientations of edges
- NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
+ NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
int aSubID = aComposite->subFeatureId(a);
const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (aConstr->shape() && aConstr->shape()->isEdge()) {
const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
setInvalidIfFalse(aSelLab, true);
owner()->data()->sendAttributeUpdated(this);
return true;
- } else {
- // if the selection is not found, put the empty shape:
+ } else {
+ // if the selection is not found, put the empty shape:
// it's better to have disappeared shape, than the old, the lost one
TNaming_Builder anEmptyBuilder(selectionLabel());
return setInvalidIfFalse(aSelLab, false);
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
aFeature->results().cbegin();
for(;aResIter != aFeature->results().cend(); aResIter++) {
- ResultConstructionPtr aRes =
+ ResultConstructionPtr aRes =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
if (aRes && aRes->shape() && aRes->shape()->isEdge()) { // found!
selectConstruction(aContext, aRes->shape());
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
aFeature->results().cbegin();
for(;aResIter != aFeature->results().cend(); aResIter++) {
- ResultConstructionPtr aRes =
+ ResultConstructionPtr aRes =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
if (aRes && aRes->shape()) {
if (aRes->shape()->isVertex() && aVertexNum == 0) { // found!
if (aBody) {
aContext = aBody->shape()->impl<TopoDS_Shape>();
} else {
- ResultPtr aResult =
+ ResultPtr aResult =
std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
if (aResult) {
aContext = aResult->shape()->impl<TopoDS_Shape>();
while(!aNewContext.IsNull() && isUpdated) {
// searching for the very last shape that was produced from this one
isUpdated = false;
- if (!TNaming_Tool::HasLabel(aSelLab, aNewContext))
+ if (!TNaming_Tool::HasLabel(aSelLab, aNewContext))
// to avoid crash of TNaming_SameShapeIterator if pure shape does not exists
break;
for(TNaming_SameShapeIterator anIter(aNewContext, aSelLab); anIter.More(); anIter.Next()) {
}
if (!isFound) { // sub-shape is not found in the up-to-date instance of the context shape
setInvalidIfFalse(aSelLab, false);
- Events_InfoMessage("Model_AttributeSelection",
+ Events_InfoMessage("Model_AttributeSelection",
"Failed to select sub-shape already modified").send();
return;
}
if (aFeatureOwner.get())
aFeatureOwner->eraseResults();
if (!aContext.IsNull()) {
- aSel.Select(aNewSub, aNewContext);
+ aSel.Select(aNewSub, aNewContext);
}
}
/// registers the name of the shape in the label (theID == 0) of sub label (theID is a tag)
-/// if theID is zero,
+/// if theID is zero,
/// theOrientation is additional information about the positioning of edge relatively to face
-/// it is stored in the integer attribute of the edge sub-label:
+/// it is stored in the integer attribute of the edge sub-label:
/// -1 is out, 1 is in, 0 is not needed
static void registerSubShape(TDF_Label theMainLabel, TopoDS_Shape theShape,
const int theID, const FeaturePtr& theContextFeature, std::shared_ptr<Model_Document> theDoc,
std::map<int, int>& theOrientations,
// name of sub-elements by ID to be exported instead of indexes
- std::map<int, std::string>& theSubNames,
+ std::map<int, std::string>& theSubNames,
Handle(TDataStd_IntPackedMap) theRefs = Handle(TDataStd_IntPackedMap)(),
const int theOrientation = 0)
{
void Model_AttributeSelection::selectConstruction(
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
- std::shared_ptr<Model_Document> aMyDoc =
+ std::shared_ptr<Model_Document> aMyDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
FeaturePtr aContextFeature = theContext->document()->feature(theContext);
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
const TopoDS_Shape& aSubShape = theSubShape->impl<TopoDS_Shape>();
if (!aComposite || aComposite->numberOfSubs() == 0) {
TColStd_MapOfTransient allCurves;
if (aShapeType == TopAbs_VERTEX) { // compare positions
aVertexPos = BRep_Tool::Pnt(TopoDS::Vertex(aSubShape));
- } else {
+ } else {
for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
Standard_Real aFirst, aLast;
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
// there may be many shapes (circle and center): register if at least one is in selection
for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (!aConstr->shape()) {
continue;
for(; anEdgeExp.More(); anEdgeExp.Next(), aTagIndex += kSTART_VERTEX_DELTA) {
TopoDS_Vertex aV = TopoDS::Vertex(anEdgeExp.Current());
- std::stringstream anAdditionalName;
+ std::stringstream anAdditionalName;
registerSubShape(
selectionLabel(), aV, aTagIndex, aContextFeature, aMyDoc, anOrientations,
aSubNames);
TNaming_Builder aBuilder(selectionLabel());
aBuilder.Generated(aSubShape);
registerSubShape(
- selectionLabel(), aSubShape, 0, aContextFeature, aMyDoc, anOrientations, aSubNames, aRefs);
+ selectionLabel(), aSubShape, 0, aContextFeature, aMyDoc, anOrientations, aSubNames, aRefs);
}
bool Model_AttributeSelection::selectPart(
return true; // postponed naming
if (theUpdate) {
Handle(TDataStd_Integer) anIndex;
- if (selectionLabel().FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
+ if (selectionLabel().FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
// by internal selection
if (anIndex->Get() > 0) {
// update the selection by index
}
Model_SelectionNaming aSelNaming(selectionLabel());
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(owner()->document());
std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected;
ResultPtr aCont;
Handle(TNaming_NamedShape) aContNS;
if (!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS))
return;
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(aContext->document());
FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
FeaturePtr aCurrentModifierFeat = aDoc->feature(aContext);
break;
if (aModifierFeat == aThisFeature || aDoc->objects()->isLater(aModifierFeat, aThisFeature))
continue; // the modifier feature is later than this, so, should not be used
- if (aCurrentModifierFeat == aModifierFeat ||
+ if (aCurrentModifierFeat == aModifierFeat ||
aDoc->objects()->isLater(aCurrentModifierFeat, aModifierFeat))
continue; // the current modifier is later than the found, so, useless
Handle(TNaming_NamedShape) aNewNS;
/// Returns a textual string of the selection
/// \param theDefaultValue a name, which is returned if the naming name can not be obtained
MODEL_EXPORT virtual std::string namingName(const std::string& theDefaultValue = "");
-
+
/// Returns an Id of the selection
/// NOTE: This method has been added for temporary export of groups towards old GEOM
/// It should then be removed when a direct use of objects from SHAPER
MODEL_EXPORT virtual void setId(int theID);
/// Selects (i.e. creates Naming data structure) of sub-shape specifed by textual name
- MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
+ MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
const std::string& theSubShapeName);
/// Returns true if attribute was initialized by some value
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
- std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
if (owner()) {
aNewAttr->setObject(owner());
aNewAttr->setValue(theContext, theSubShape, theTemporarily);
if (theTemporarily)
myTmpAttr = aNewAttr;
- else
+ else
myTmpAttr.reset();
owner()->data()->sendAttributeUpdated(this);
}
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
- std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
if (owner()) {
aNewAttr->setObject(owner());
}
}
-void Model_AttributeSelectionList::removeLast()
+void Model_AttributeSelectionList::removeLast()
{
int anOldSize = mySize->Get();
if (anOldSize != 0) {
mySize->Set(anOldSize - 1);
TDF_Label aLab = mySize->Label().FindChild(anOldSize);
- std::shared_ptr<Model_AttributeSelection> aOldAttr =
+ std::shared_ptr<Model_AttributeSelection> aOldAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLab));
aOldAttr->setObject(owner());
REMOVE_BACK_REF(aOldAttr->context());
}
}
-// copies named shapes: we need the implementation of this
+// copies named shapes: we need the implementation of this
static void CopyNS(const Handle(TNaming_NamedShape)& theFrom,
const Handle(TDF_Attribute)& theTo)
-{
+{
TDF_Label aLab = theTo->Label();
TNaming_Builder B(aLab);
case TNaming_GENERATED :
B.Generated(aOldIter.Value(), aNewIter.Value());
break;
- case TNaming_MODIFY :
+ case TNaming_MODIFY :
B.Modify(aOldIter.Value(), aNewIter.Value());
break;
- case TNaming_DELETE :
+ case TNaming_DELETE :
B.Delete (aOldIter.Value());
break;
case TNaming_SELECTED :
Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(anAttrIter.Value());
if (aNS.IsNull()) {
// no relocation, empty map
- Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable();
+ Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable();
anAttrIter.Value()->Paste(aTargetAttr, aRelocTable);
} else {
CopyNS(aNS, aTargetAttr);
}
} else { // this is removed, so remove everything from this label
TDF_Label aLab = mySize->Label().FindChild(aCurrent + 1);
- std::shared_ptr<Model_AttributeSelection> aOldAttr =
+ std::shared_ptr<Model_AttributeSelection> aOldAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLab));
aOldAttr->setObject(owner());
REMOVE_BACK_REF(aOldAttr->context());
mySelectionType->Set(theType.c_str());
}
-std::shared_ptr<ModelAPI_AttributeSelection>
+std::shared_ptr<ModelAPI_AttributeSelection>
Model_AttributeSelectionList::value(const int theIndex)
{
if (myTmpAttr.get() && theIndex == size() - 1) {
// create a new attribute each time, by demand
// supporting of old attributes is too slow (synch each time) and buggy on redo
// (if attribute is deleted and created, the abort updates attriute and makes the Attr invalid)
- std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
aNewAttr->setID(id());
if (owner()) {
TDF_ChildIterator aSubIter(mySize->Label());
for(; aSubIter.More(); aSubIter.Next()) {
TDF_Label aLab = aSubIter.Value();
- std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLab));
if (owner()) {
aNewAttr->setObject(owner());
#include <GeomDataAPI_Point.h>
#include <GeomDataAPI_Point2D.h>
-bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments,
+bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) {
}
} else
if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) {
- AttributeDoublePtr anAttribue =
+ AttributeDoublePtr anAttribue =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
if (!anAttribue->expressionError().empty()) {
theError = "Expression error: %1";
}
} else
if (theAttribute->attributeType() == GeomDataAPI_Point::typeId()) {
- AttributePointPtr anAttribue =
+ AttributePointPtr anAttribue =
std::dynamic_pointer_cast<GeomDataAPI_Point>(theAttribute);
const char* aComponent[] = {"X", "Y", "Z"};
}
} else
if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) {
- AttributePoint2DPtr anAttribue =
+ AttributePoint2DPtr anAttribue =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
const char* aComponent[] = {"X", "Y"};
} else {
TDataStd_Integer::Set(theLab, anEvolution);
}
-
+
for(TNaming_Iterator anIter(aName); anIter.More(); anIter.Next()) {
// iterator goes in reversed order relatively to the Builder, to, make the list reversed
aShapePairs.push_front(std::pair<TopoDS_Shape, TopoDS_Shape>
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
- clean();
+ clean();
// store the new shape as primitive
TNaming_Builder aBuilder(aShapeLab);
if (!theShape)
}
}
- aBuilder.Generated(aShape);
+ aBuilder.Generated(aShape);
// register name
aShapeLab.ForgetAttribute(TDF_Reference::GetID());
if(!aBuilder.NamedShape()->IsEmpty()) {
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
- clean();
+ clean();
// store the new shape as primitive
TNaming_Builder aBuilder(aShapeLab);
if (!theFromShape || !theToShape)
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
- clean();
+ clean();
// store the new shape as primitive
TNaming_Builder aBuilder(aShapeLab);
if (!theOldShape || !theNewShape)
if (aShapeNew.IsNull())
return; // null shape inside
aBuilder.Modify(aShapeOld, aShapeNew);
- if (theDecomposeSolidsTag && aShapeNew.ShapeType() == TopAbs_COMPOUND) {
+ if (theDecomposeSolidsTag && aShapeNew.ShapeType() == TopAbs_COMPOUND) {
// make sub elements as subs
// register name if it is possible
if(!aName.IsEmpty()) {
TCollection_AsciiString aShapeType = aShape.ShapeType() == TopAbs_EDGE ? "_Edge_" :
aShape.ShapeType() == TopAbs_FACE ? "_Face_" :
- aShape.ShapeType() == TopAbs_SOLID ? "_Solid_" :
+ aShape.ShapeType() == TopAbs_SOLID ? "_Solid_" :
"_Shape_";
- std::string aSolidName =
+ std::string aSolidName =
(aName + aShapeType + TCollection_AsciiString(aTag - theDecomposeSolidsTag))
.ToCString();
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aSubBuilder.NamedShape()->Label(), aSolidName);
TDataStd_Name::Set(aSubBuilder.NamedShape()->Label(), aSolidName.c_str());
if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
if(!aName.empty()) {
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
}
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
- clean();
+ clean();
if (!theShape.get())
return; // bad shape
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
{
TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
builder(theTag)->Generated(aShape);
- if(!theName.empty())
+ if(!theName.empty())
buildName(theTag, theName);
}
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
builder(theTag)->Generated(anOldShape, aNewShape);
- if(!theName.empty())
+ if(!theName.empty())
buildName(theTag, theName);
TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
builder(theTag)->Modify(anOldShape, aNewShape);
- if(!theName.empty())
+ if(!theName.empty())
buildName(theTag, theName);
}
std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->generated(aRShape, aList);
- std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
}
TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
- TopAbs_ShapeEnum anExplodeShapeType =
+ TopAbs_ShapeEnum anExplodeShapeType =
aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
const TDF_Label aLabel = builder(theTag)->NamedShape()->Label();
int aTag = 1;
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(document());
for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) {
TDF_Label aChildLabel = aLabel.FindChild(aTag);
TNaming_Builder aBuilder(aChildLabel);
aBuilder.Generated(aRoot, anExp.Current());
- TCollection_AsciiString aChildName =
+ TCollection_AsciiString aChildName =
TCollection_AsciiString((theName + "_").c_str()) + aTag;
TDataStd_Name::Set(aChildLabel, aChildName.ToCString());
aTag++;
}
//=======================================================================
-int getDangleShapes(const TopoDS_Shape& theShapeIn,
+int getDangleShapes(const TopoDS_Shape& theShapeIn,
const TopAbs_ShapeEnum theGeneratedFrom,
- TopTools_DataMapOfShapeShape& theDangles)
+ TopTools_DataMapOfShapeShape& theDangles)
{
theDangles.Clear();
TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors;
TopTools_DataMapOfShapeShape dangles;
if (!getDangleShapes(theShapeIn, theGeneratedFrom, dangles)) return;
TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles);
- for (; itr.More(); itr.Next())
+ for (; itr.More(); itr.Next())
theBuilder->Generated(itr.Key(), itr.Value());
}
//=======================================================================
-void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
+void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag)
{
if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
std::string aName;
- if (aShape.ShapeType() == TopAbs_SOLID) {
+ if (aShape.ShapeType() == TopAbs_SOLID) {
TopExp_Explorer expl(aShape, TopAbs_FACE);
- for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
+ for (; expl.More(); expl.Next()) {
+ builder(theTag)->Generated(expl.Current());
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
buildName(theTag, aName);
if (Faces.Extent() > 1 || (aShape.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) {
TopExp_Explorer expl(aShape, TopAbs_FACE);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
+ builder(theTag)->Generated(expl.Current());
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
buildName(theTag, aName);
}
TopTools_IndexedDataMapOfShapeListOfShape anEdgeAndNeighbourFaces;
TopExp::MapShapesAndAncestors(aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeAndNeighbourFaces);
- for (Standard_Integer i = 1; i <= anEdgeAndNeighbourFaces.Extent(); i++)
+ for (Standard_Integer i = 1; i <= anEdgeAndNeighbourFaces.Extent(); i++)
{
const TopTools_ListOfShape& aLL = anEdgeAndNeighbourFaces.FindFromIndex(i);
if (aLL.Extent() < 2) {
theTag++;
}
} else {
- TopExp_Explorer expl(aShape, TopAbs_EDGE);
- for (; expl.More(); expl.Next()) {
+ TopExp_Explorer expl(aShape, TopAbs_EDGE);
+ for (; expl.More(); expl.Next()) {
builder(theTag)->Generated(expl.Current());
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
buildName(theTag, aName);
theTag++;
- }
+ }
// and load generated vertices.
TopTools_DataMapOfShapeShape generated;
- if (getDangleShapes(aShape, TopAbs_EDGE, generated))
+ if (getDangleShapes(aShape, TopAbs_EDGE, generated))
{
TNaming_Builder* pBuilder = builder(theTag++);
- loadGeneratedDangleShapes(aShape, TopAbs_EDGE, pBuilder);
+ loadGeneratedDangleShapes(aShape, TopAbs_EDGE, pBuilder);
}
}
} else if (aShape.ShapeType() == TopAbs_EDGE) {
TopExp_Explorer expl(aShape, TopAbs_VERTEX);
- for (; expl.More(); expl.Next()) {
+ for (; expl.More(); expl.Next()) {
builder(theTag)->Generated(expl.Current());
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
}
//=======================================================================
-int findAmbiguities(const TopoDS_Shape& theShapeIn,
- TopTools_ListOfShape& theList)
+int findAmbiguities(const TopoDS_Shape& theShapeIn,
+ TopTools_ListOfShape& theList)
{
int aNumEdges(0);
theList.Clear();
if(ancestors1.Extent() == ancestors2.Extent() && ancestors1.Extent() > 1) {
int aNum (ancestors2.Extent());
TopTools_ListIteratorOfListOfShape it(ancestors2);
- for(;it.More();it.Next())
+ for(;it.More();it.Next())
if(aMap1.Contains(it.Value())) aNum--;
if(aNum == 0) {
- if(aMap2.Add(aKeyEdge1))
+ if(aMap2.Add(aKeyEdge1))
aKeyList.Append(aKeyEdge1);
if(aMap2.Add(aKeyEdge2))
aKeyList.Append(aKeyEdge2);
}
}
- } // at the end ==> List of edges to be named in addition
+ } // at the end ==> List of edges to be named in addition
}
aNumEdges = aKeyList.Extent();
if(aNumEdges)
- theList.Assign(aKeyList);
- return aNumEdges;
+ theList.Assign(aKeyList);
+ return aNumEdges;
}
//=======================================================================
std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag)
{
if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
std::string aName;
if (aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID) {
TopoDS_Iterator itr(aShape);
aName = theName + aStr.ToCString();
buildName(theTag, aName);
if(!theName.empty()) buildName(theTag, aName);
- if (itr.Value().ShapeType() == TopAbs_COMPOUND ||
- itr.Value().ShapeType() == TopAbs_COMPSOLID)
+ if (itr.Value().ShapeType() == TopAbs_COMPOUND ||
+ itr.Value().ShapeType() == TopAbs_COMPSOLID)
{
std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(itr.Value()));
loadFirstLevel(itrShape, theName, theTag);
} else {
std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
- itrShape->setImpl(new TopoDS_Shape(itr.Value()));
+ itrShape->setImpl(new TopoDS_Shape(itr.Value()));
loadNextLevels(itrShape, theName, theTag);
}
}
} else {
std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(aShape));
- loadNextLevels(itrShape, theName, theTag);
+ loadNextLevels(itrShape, theName, theTag);
}
TopTools_ListOfShape aList;
if(findAmbiguities(aShape, aList)) {
std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag)
{
if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
TopTools_DataMapOfShapeListOfShape edgeNaborFaces;
TopTools_ListOfShape empty;
TopExp_Explorer explF(aShape, TopAbs_FACE);
break;
}
}
- if (faceIsNew)
- edgeNaborFaces.ChangeFind(anEdge).Append(aFace);
+ if (faceIsNew)
+ edgeNaborFaces.ChangeFind(anEdge).Append(aFace);
}
}
TopTools_MapOfShape anEdgesToDelete;
- TopExp_Explorer anEx(aShape,TopAbs_EDGE);
+ TopExp_Explorer anEx(aShape,TopAbs_EDGE);
std::string aName;
for(;anEx.More();anEx.Next()) {
Standard_Boolean aC0 = Standard_False;
theTag++;
}
}
- }
+ }
TopTools_MapIteratorOfMapOfShape itDelete(anEdgesToDelete);
- for(;itDelete.More();itDelete.Next())
- edgeNaborFaces.UnBind(itDelete.Key());
+ for(;itDelete.More();itDelete.Next())
+ edgeNaborFaces.UnBind(itDelete.Key());
edgeNaborFaces.UnBind(anEdge1);
}
if (aC0) {
builder(theTag)->Generated(anEdge1);
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
- buildName(theTag, aName);
+ buildName(theTag, aName);
theTag++;
}
- }
+ }
}
void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag)
{
if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
TopTools_DataMapOfShapeListOfShape vertexNaborEdges;
TopTools_ListOfShape empty;
TopExp_Explorer explF(aShape, TopAbs_EDGE);
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(vertexNaborEdges);
for (; itr.More(); itr.Next()) {
const TopTools_ListOfShape& naborEdges = itr.Value();
- if (naborEdges.Extent() < 2) {
+ if (naborEdges.Extent() < 2) {
builder(theTag)->Generated(itr.Key());
TCollection_AsciiString aStr(theTag);
aName = theName + aStr.ToCString();
- buildName(theTag, aName);
+ buildName(theTag, aName);
theTag++;
}
}
bool Model_BodyBuilder::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
{
if (theShape.get()) {
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
*/
class Model_BodyBuilder : public ModelAPI_BodyBuilder
{
- /// builders that tores the naming history: one per label to allow store several shapes to one
+ /// builders that tores the naming history: one per label to allow store several shapes to one
/// label; index in vector corresponds to the label tag
std::vector<TNaming_Builder*> myBuilders;
public:
/// Stores the modified shape (called by the execution method).
/// \param theOldShape shape that produces result
/// \param theNewShape resulting shape
- /// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
+ /// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
/// theNewShape is compound of solids, if zero it is not used
MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
const std::shared_ptr<GeomAPI_Shape>& theNewShape,
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
- MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
+ MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const std::string& theName, const int theTag = 1);
/// Records the shape newShape which was generated from the shape oldShape during a topological
- /// construction. As an example, consider the case of a face generated from an edge in
+ /// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const std::string& theName, const int theTag = 1);
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const std::string& theName, const int theTag = 1);
/// Records the shape oldShape which was deleted from the current label.
const int theTag,
const std::string& theName,
GeomAPI_DataMapOfShapeShape& theSubShapes);
-
+
/// Loads shapes of the first level (to be used during shape import)
MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
-
+
/// Loads disconnected edges
MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
/// Loads disconnected vetexes
- MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
+ MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_BodyBuilder();
- /// Converts evolution of sub-shapes stored in naming structure to selection
+ /// Converts evolution of sub-shapes stored in naming structure to selection
/// (theFlag = true) and back (theFlag = false)
MODEL_EXPORT virtual void evolutionToSelection(const bool theFlag);
private:
/// Loads shapes of the next level (to be used during shape import)
- void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
+ void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
- /// builds name for the shape kept at the specified tag
+ /// builds name for the shape kept at the specified tag
void buildName(const int theTag, const std::string& theName);
friend class Model_ResultBody;
Standard_Boolean aFlag2 = myFlags->Upper() >= 2 ? myFlags->Value(2) : Standard_True;
Handle(TColStd_HArray1OfByte) aNewArray = new TColStd_HArray1OfByte(0, 2);
myFlags->SetInternalArray(aNewArray);
- myFlags->SetValue(0, aFlag0);
- myFlags->SetValue(1, aFlag1);
- myFlags->SetValue(2, aFlag2);
+ myFlags->SetValue(0, aFlag0);
+ myFlags->SetValue(1, aFlag1);
+ myFlags->SetValue(2, aFlag2);
}
}
anAttr->setObject(myObject);
anAttr->setID(theID);
} else {
- Events_InfoMessage("Model_Data",
+ Events_InfoMessage("Model_Data",
"Can not create unknown type of attribute %1").arg(theAttrType).send();
}
return aResult;
const std::string& Model_Data::id(const std::shared_ptr<ModelAPI_Attribute>& theAttr)
{
- std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr =
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr =
myAttrs.begin();
for (; anAttr != myAttrs.end(); anAttr++) {
if (anAttr->second == theAttr)
std::list<std::shared_ptr<ModelAPI_Attribute> > Model_Data::attributes(const std::string& theType)
{
std::list<std::shared_ptr<ModelAPI_Attribute> > aResult;
- std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
if (theType.empty() || anAttrsIter->second->attributeType() == theType) {
return aResult;
}
-std::list<std::string> Model_Data::attributesIDs(const std::string& theType)
+std::list<std::string> Model_Data::attributesIDs(const std::string& theType)
{
std::list<std::string> aResult;
- std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
if (theType.empty() || anAttrsIter->second->attributeType() == theType) {
if (mySendAttributeUpdated && !myWasChangedButBlocked.empty()) {
// so, now it is ok to send the update signal
if (theSendMessage) {
- // make a copy to avoid iteration on modified list
+ // make a copy to avoid iteration on modified list
// (may be cleared by attribute changed call)
std::list<ModelAPI_Attribute*> aWasChangedButBlocked = myWasChangedButBlocked;
myWasChangedButBlocked.clear();
// remove in order to clear back references in other objects
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator
anAttrIter = aRefs.begin();
for(; anAttrIter != aRefs.end(); anAttrIter++) {
std::list<ObjectPtr>::iterator aReferenced = anAttrIter->second.begin();
for(; aReferenced != anAttrIter->second.end(); aReferenced++) {
if (aReferenced->get() && (*aReferenced)->data()->isValid()) {
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>((*aReferenced)->data());
aData->removeBackReference(myAttrs[anAttrIter->first]);
}
void Model_Data::eraseBackReferences()
{
myRefsToMe.clear();
- std::shared_ptr<ModelAPI_Result> aRes =
+ std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes)
aRes->setIsConcealed(false);
}
}
-void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID,
+void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID,
const bool theApplyConcealment)
{
// it is possible to add the same attribute twice: may be last time the owner was not Stable...
if (myRefsToMe.find(anAttribute) == myRefsToMe.end())
myRefsToMe.insert(theFeature->data()->attribute(theAttrID));
- if (theApplyConcealment && theFeature->isStable() &&
+ if (theApplyConcealment && theFeature->isStable() &&
ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {
- std::shared_ptr<ModelAPI_Result> aRes =
+ std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
// the second condition is for history upper than concealment causer, so the feature result may
// be displayed and previewed; also for avoiding of quick show/hide on history
// moving deep down
- if (aRes && !theFeature->isDisabled() &&
+ if (aRes && !theFeature->isDisabled() &&
!ModelAPI_Session::get()->validators()->isUnconcealed(aRes, theFeature)) {
aRes->setIsConcealed(true);
}
if (aFeature.get() && !aFeature->isDisabled() && aFeature->isStable()) {
if (ModelAPI_Session::get()->validators()->isConcealed(
aFeature->getKind(), (*aRefsIter)->id())) {
- std::shared_ptr<ModelAPI_Result> aRes =
+ std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes.get()) {
if (!ModelAPI_Session::get()->validators()->isUnconcealed(aRes, aFeature)) {
}
}
}
- std::shared_ptr<ModelAPI_Result> aRes =
+ std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes.get()) {
aRes->setIsConcealed(false);
}
}
-std::set<std::string> set_union(const std::set<std::string>& theLeft,
+std::set<std::string> set_union(const std::set<std::string>& theLeft,
const std::set<std::string>& theRight)
{
std::set<std::string> aResult;
const std::string& aName = *aParamIt;
double aValue;
ResultParameterPtr aParam;
- // theSearcher is not needed here: in expressions
+ // theSearcher is not needed here: in expressions
// of features the parameters history is not needed
if (ModelAPI_Tools::findVariable(FeaturePtr(), aName, aValue, aParam))
aResult.push_back(aParam);
void Model_Data::referencesToObjects(
std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs)
{
- static Model_ValidatorsFactory* aValidators =
+ static Model_ValidatorsFactory* aValidators =
static_cast<Model_ValidatorsFactory*>(ModelAPI_Session::get()->validators());
FeaturePtr aMyFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(myObject);
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection>
selection(const std::string& theID);
/// Returns the attribute that contains selection to a shape
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
selectionList(const std::string& theID);
/// Returns the attribute that contains reference to an attribute of a feature
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefAttr>
/// \param theID identifier of the attribute that can be referenced by this ID later
/// \param theAttrType type of the created attribute (received from the type method)
/// \returns the just created attribute
- MODEL_EXPORT virtual AttributePtr
+ MODEL_EXPORT virtual AttributePtr
addAttribute(const std::string& theID, const std::string theAttrType);
/// Useful method for "set" methods of the attributes: sends an UPDATE event and
MODEL_EXPORT virtual const std::set<AttributePtr>& refsToMe() {return myRefsToMe;}
/// returns all references by attributes of this data
- /// \param theRefs returned list of pairs:
+ /// \param theRefs returned list of pairs:
/// id of referenced attribute and list of referenced objects
MODEL_EXPORT virtual void referencesToObjects(
std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
/// \param theFeature feature referenced to this
/// \param theAttrID identifier of the attribute that is references from theFeature to this
/// \param theApplyConcealment applies consealment flag changes
- void addBackReference(FeaturePtr theFeature, std::string theAttrID,
+ void addBackReference(FeaturePtr theFeature, std::string theAttrID,
const bool theApplyConcealment = true);
/// Makes the concealment flag up to date for this object-owner.
CDF_Session::CurrentSession()->Directory()->Add(myDoc);
#endif
myObjs = new Model_Objects(myDoc->Main());
- myDoc->SetUndoLimit(UNDO_LIMIT);
+ myDoc->SetUndoLimit(UNDO_LIMIT);
myTransactionSave = 0;
myExecuteFeatures = true;
// to have something in the document and avoid empty doc open/save problem
{
TCollection_ExtendedString aPath((const Standard_CString) theDirName);
// remove end-separators
- while(aPath.Length() &&
+ while(aPath.Length() &&
(aPath.Value(aPath.Length()) == '\\' || aPath.Value(aPath.Length()) == '/'))
aPath.Remove(aPath.Length());
aPath += _separator_;
Events_InfoMessage("Model_Document", "Can not open document: already opened").send();
break;
case PCDM_RS_AlreadyRetrievedAndModified:
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not open document: already opened and modified").send();
break;
case PCDM_RS_NoDriver:
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not open document: driver library is not found").send();
break;
case PCDM_RS_UnknownFileDriver:
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not open document: unknown driver for opening").send();
break;
case PCDM_RS_OpenError:
Events_InfoMessage("Model_Document", "Can not open document: invalid object").send();
break;
case PCDM_RS_UnrecognizedFileFormat:
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not open document: unrecognized file format").send();
break;
case PCDM_RS_MakeFailure:
break;
}
}
- std::shared_ptr<Model_Session> aSession =
+ std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
if (!isError) {
myDoc = aLoaded;
} else { // open failed, but new documnet was created to work with it: inform the model
aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
- }
+ }
return !isError;
}
aStatus = anApp->SaveAs(myDoc, aPath);
} catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Exception in saving of document: %1").arg(aFail->GetMessageString()).send();
return false;
}
if (!isDone) {
switch (aStatus) {
case PCDM_SS_DriverFailure:
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not save document: save driver-library failure").send();
break;
case PCDM_SS_WriteFailure:
aFile.Copy(aDestination);
theResults.push_back(aDestinationDir.ToCString());
} else {
- Events_InfoMessage("Model_Document",
+ Events_InfoMessage("Model_Document",
"Can not open file %1 for saving").arg(aSubPath.ToCString()).send();
}
}
{
incrementTransactionID(); // outside of transaction in order to avoid empty transactions keeping
if (myDoc->HasOpenCommand()) { // start of nested command
- if (myDoc->CommitCommand()) {
+ if (myDoc->CommitCommand()) {
// commit the current: it will contain all nested after compactification
myTransactions.rbegin()->myOCAFNum++; // if has open command, the list is not empty
}
return false;
}
-/// Returns true if the last transaction is actually empty: modification to te same values
+/// Returns true if the last transaction is actually empty: modification to te same values
/// were performed only
static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) {
Handle(TDF_Delta) aDelta;
if (isEqualContent(anADelta->Attribute(), aCurrentAttr)) {
continue; // attribute is not changed actually
}
- } else
+ } else
if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), TDataStd_AsciiString::GetID())) {
continue; // error message is disappeared
}
bool Model_Document::finishOperation()
{
bool isNestedClosed = !myDoc->HasOpenCommand() && !myNestedNum.empty();
- static std::shared_ptr<Model_Session> aSession =
+ static std::shared_ptr<Model_Session> aSession =
std::static_pointer_cast<Model_Session>(Model_Session::get());
- // open transaction if nested is closed to fit inside
+ // open transaction if nested is closed to fit inside
// all synchronizeBackRefs and flushed consequences
if (isNestedClosed) {
myDoc->OpenCommand();
}
// do it before flashes to enable and recompute nesting features correctly
if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) {
- // if all nested operations are closed, make current the higher level objects (to perform
+ // if all nested operations are closed, make current the higher level objects (to perform
// it in the python scripts correctly): sketch become current after creation ofsub-elements
FeaturePtr aCurrent = currentFeature(false);
CompositeFeaturePtr aMain, aNext = ModelAPI_Tools::compositeOwner(aCurrent);
if (myDoc->CommitCommand())
myTransactions.rbegin()->myOCAFNum++;
}
-
+
// this must be here just after everything is finished but before real transaction stop
// to avoid messages about modifications outside of the transaction
// and to rebuild everything after all updates and creates
aResult = true;
// transaction may be empty if this document was created during this transaction (create part)
- if (!myTransactions.empty() && myDoc->CommitCommand()) {
+ if (!myTransactions.empty() && myDoc->CommitCommand()) {
// if commit is successfull, just increment counters
if (isEmptyTransaction(myDoc)) { // erase this transaction
myDoc->Undo();
Handle(TDF_Delta) aDelta;
if (isRedo)
aDelta = theDoc->GetRedos().First();
- else
+ else
aDelta = theDoc->GetUndos().Last();
TDF_LabelList aDeltaList;
aDelta->Labels(aDeltaList); // it clears list, so, use new one and then append to the result
// add also label of the modified attributes
const TDF_AttributeDeltaList& anAttrs = aDelta->AttributeDeltas();
/// named shape evolution also modifies integer on this label: exclude it
- TDF_LabelMap anExcludedInt;
+ TDF_LabelMap anExcludedInt;
for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); anAttr.Next()) {
if (anAttr.Value()->Attribute()->ID() == TDataStd_BooleanArray::GetID()) {
// Boolean array is used for feature auxiliary attributes only, feature args are not modified
- continue;
+ continue;
}
if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) {
anExcludedInt.Add(anAttr.Value()->Label());
- // named shape evolution is changed in history update => skip them,
+ // named shape evolution is changed in history update => skip them,
// they are not the features arguents
- continue;
+ continue;
}
if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) {
if (anExcludedInt.Contains(anAttr.Value()->Label()))
{
// issue 406 : if transaction is opened, but nothing to undo behind, can not undo
int aCurrentNum = isOperation() ? 1 : 0;
- if (myDoc->GetAvailableUndos() > 0 &&
+ if (myDoc->GetAvailableUndos() > 0 &&
// there is something to undo in nested
- (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) &&
+ (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) &&
myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */)
return true;
// check other subs contains operation that can be undoed
FeaturePtr Model_Document::addFeature(std::string theID, const bool theMakeCurrent)
{
- std::shared_ptr<Model_Session> aSession =
+ std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(ModelAPI_Session::get());
FeaturePtr aFeature = aSession->createFeature(theID, this);
if (!aFeature)
FeaturePtr aCurrent = aDocToAdd->currentFeature(false);
bool isModified = true;
for(CompositeFeaturePtr aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCurrent);
- aComp.get() && isModified;
+ aComp.get() && isModified;
aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCurrent)) {
isModified = false;
int aSubs = aComp->numberOfSubs(false);
if (aCurrentUp) {
setCurrentFeatureUp();
}
- // if user adds after high-level feature with nested,
+ // if user adds after high-level feature with nested,
// add it after all nested (otherwise the nested will be disabled)
- CompositeFeaturePtr aCompositeAfter =
+ CompositeFeaturePtr aCompositeAfter =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theAfterThis);
if (aCompositeAfter.get()) {
FeaturePtr aSub = aCompositeAfter;
}
}
- if (theVisible && !theCurrent.get()) {
+ if (theVisible && !theCurrent.get()) {
// needed to avoid disabling of PartSet initial constructions
- FeaturePtr aNext =
+ FeaturePtr aNext =
theCurrent.get() ? myObjs->nextFeature(theCurrent) : myObjs->firstFeature();
for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent)) {
if (aNext->isInHistory()) {
if (aMain.get()) {
if (isSub(aMain, anIter)) // sub-elements of not-disabled feature are not disabled
aDisabledFlag = false;
- else if (anOwners.find(anIter) != anOwners.end())
+ else if (anOwners.find(anIter) != anOwners.end())
// disable the higher-level feature is the nested is the current
aDisabledFlag = true;
}
// due to the issue 1491 all parameters are kept enabled any time
//if (!isCurrentParameter)
aDisabledFlag = false;
- } else if (isCurrentParameter) {
+ } else if (isCurrentParameter) {
// if paramater is active, all other features become enabled (issue 1307)
aDisabledFlag = false;
}
if (anIter->setDisabled(aDisabledFlag)) {
static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED);
// state of feature is changed => so inform that it must be updated if it has such state
- if (!aDisabledFlag &&
- (anIter->data()->execState() == ModelAPI_StateMustBeUpdated ||
+ if (!aDisabledFlag &&
+ (anIter->data()->execState() == ModelAPI_StateMustBeUpdated ||
anIter->data()->execState() == ModelAPI_StateInvalidArgument))
ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent);
// flush is in the end of this method
void Model_Document::setCurrentFeatureUp()
{
- // on remove just go up for minimum step: highlight external objects in sketch causes
+ // on remove just go up for minimum step: highlight external objects in sketch causes
// problems if it is true: here and in "setCurrentFeature"
FeaturePtr aCurrent = currentFeature(false);
if (aCurrent.get()) { // if not, do nothing because null is the upper
// make the higher level composite as current (sketch becomes disabled if line is enabled)
if (aPrev.get()) {
FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev);
- // without cycle (issue 1555): otherwise extrusion fuse
+ // without cycle (issue 1555): otherwise extrusion fuse
// will be enabled and displayed whaen inside sketch
- if (aComp.get())
+ if (aComp.get())
aPrev = aComp;
}
// do not flush: it is called only on remove, it will be flushed in the end of transaction
void Model_Document::synchronizeTransactions()
{
- Model_Document* aRoot =
+ Model_Document* aRoot =
std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument()).get();
if (aRoot == this)
return; // don't need to synchronise root with root
- std::shared_ptr<Model_Session> aSession =
+ std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
while(myRedos.size() > aRoot->myRedos.size()) { // remove redos in this
aSession->setCheckTransactions(false);
if (!mySelectionFeature.get() || !mySelectionFeature->data()->isValid()) {
// create a new one
mySelectionFeature = FeaturePtr(new Model_SelectionInPartFeature);
-
+
TDF_Label aFeatureLab = generalLabel().FindChild(TAG_SELECTION_FEATURE);
std::shared_ptr<Model_Data> aData(new Model_Data);
aData->setLabel(aFeatureLab.FindChild(1));
Handle(TNaming_NamedShape) aNS;
if (aNSLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) {
- if (aShapesIter.Evolution() == TNaming_SELECTED ||
+ if (aShapesIter.Evolution() == TNaming_SELECTED ||
aShapesIter.Evolution() == TNaming_DELETE)
continue; // don't use the selection evolution
if (aShapesIter.NewShape().IsSame(aShape)) { // found the original shape
if (aResult->Evolution() == TNaming_MODIFY)
theShape = aShapesIter.OldShape();
// otherwise may me searching for another item of this shape with longer history
- if (!theShape.IsNull())
+ if (!theShape.IsNull())
break;
}
}
if (aCandidatInThis->Evolution() == TNaming_MODIFY)
anOldShape = aShapesIter.OldShape();
// otherwise may me searching for another item of this shape with longer history
- if (!anOldShape.IsNull())
+ if (!anOldShape.IsNull())
break;
}
// check that the shape contains aShape as sub-shape to fill container
}
}
if (aCandidatInThis.IsNull()) {
- // to fix 1512: searching for original shape of this shape
+ // to fix 1512: searching for original shape of this shape
// if modification of it is not in this result
aCandidatInThis = searchForOriginalShape(aShape, myDoc->Main());
if (aCandidatInThis.IsNull()) {
const char* theDirName, const char* theFileName, std::list<std::string>& theResults);
//! Removes document data
- //! \param theForever if it is false, document is just hiden
+ //! \param theForever if it is false, document is just hiden
//! (to keep possibility make it back on Undo/Redo)
MODEL_EXPORT virtual void close(const bool theForever = false);
//! Finishes the previously started operation (closes the transaction)
//! \returns true if transaction in this document is not empty and really was performed
MODEL_EXPORT virtual bool finishOperation();
- //! Aborts the operation
+ //! Aborts the operation
MODEL_EXPORT virtual void abortOperation();
//! Returns true if operation has been started, but not yet finished or aborted
MODEL_EXPORT virtual bool isOperation() const;
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
//! Performs synchronization of transactions with the module document:
//! If some document is not active (by undo of activation) but in memory,
- //! on activation the transactions must be synchronised because all redos performed
+ //! on activation the transactions must be synchronised because all redos performed
//! wihtout this participation
MODEL_EXPORT virtual void synchronizeTransactions();
//! Returns true if this document is currently active
virtual bool isActive() const;
- //! Returns the selection attribute that is used
+ //! Returns the selection attribute that is used
//! for calculation of selection externally from the document
std::shared_ptr<ModelAPI_AttributeSelectionList> selectionInPartFeature();
void Model_ObjectUpdatedMessage::Join(const std::shared_ptr<Events_MessageGroup>& theJoined)
{
- std::shared_ptr<Model_ObjectUpdatedMessage> aJoined =
+ std::shared_ptr<Model_ObjectUpdatedMessage> aJoined =
std::dynamic_pointer_cast<Model_ObjectUpdatedMessage>(theJoined);
std::set<ObjectPtr>::iterator aFIter = aJoined->myObjects.begin();
for (; aFIter != aJoined->myObjects.end(); aFIter++) {
void Model_ObjectDeletedMessage::Join(const std::shared_ptr<Events_MessageGroup>& theJoined)
{
- std::shared_ptr<Model_ObjectDeletedMessage> aJoined =
+ std::shared_ptr<Model_ObjectDeletedMessage> aJoined =
std::dynamic_pointer_cast<Model_ObjectDeletedMessage>(theJoined);
std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
for (; aGIter != aJoined->myGroups.end(); aGIter++) {
setError(text().empty() ? "" : "Not a double value.");
}
-std::string Model_Expression::text() const
+std::string Model_Expression::text() const
{
return TCollection_AsciiString(myText->Get()).ToCString();
}
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- static Model_ValidatorsFactory* aValidators =
+ static Model_ValidatorsFactory* aValidators =
static_cast<Model_ValidatorsFactory*>(ModelAPI_Session::get()->validators());
std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- // "Action" features has no data, but still valid. e.g "Remove Part"
+ // "Action" features has no data, but still valid. e.g "Remove Part"
if (!aData->isValid()) {
if (!theFeature->isAction())
theError = "There is no data.";
if (!aValidators->isCase(theFeature, anAttr->id()))
continue; // this attribute is not participated in the current case
if (!anAttr->isInitialized()) { // attribute is not initialized
- std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind =
+ std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind =
myNotObligatory.find(theFeature->getKind());
if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling
aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
// in initData it creates new features, appeared later than this
TDF_Label aPrevFeateureLab;
if (theAfterThis.get()) { // searching for the previous feature label
- std::shared_ptr<Model_Data> aPrevData =
+ std::shared_ptr<Model_Data> aPrevData =
std::dynamic_pointer_cast<Model_Data>(theAfterThis->data());
if (aPrevData.get()) {
aPrevFeateureLab = aPrevData->label().Father();
/// Appends to the array of references a new referenced label.
/// If theIndex is not -1, removes element at this index, not theReferenced.
/// \returns the index of removed element
-static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced,
+static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced,
const int theIndex = -1)
{
int aResult = -1; // no returned
std::list<ResultPtr>::const_iterator aResIter = aResults.cbegin();
for (; aResIter != aResults.cend(); aResIter++) {
ResultPtr aResult = (*aResIter);
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(aResult->data());
if (aData.get() != NULL) {
const std::set<AttributePtr>& aRefs = aData->refsToMe();
}
}
// the dependencies can be in the feature itself
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theFeature->data());
if (aData.get() && !aData->refsToMe().empty()) {
const std::set<AttributePtr>& aRefs = aData->refsToMe();
}
if (!theRefs.empty() && isSendError) {
- Events_InfoMessage("Model_Objects",
+ Events_InfoMessage("Model_Objects",
"Feature '%1' is used and can not be deleted").arg(theFeature->data()->name()).send();
}
}
refsToFeature(theFeature, aRefs, false);
std::set<std::shared_ptr<ModelAPI_Feature> >::iterator aRefIter = aRefs.begin();
for(; aRefIter != aRefs.end(); aRefIter++) {
- std::shared_ptr<ModelAPI_CompositeFeature> aComposite =
+ std::shared_ptr<ModelAPI_CompositeFeature> aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aRefIter);
if (aComposite.get() && aComposite->isSub(theFeature)) {
aComposite->removeFeature(theFeature);
Handle(TDataStd_ReferenceArray) aRefs;
if (!aFeaturesLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs))
return;
- TDF_Label anAfterLab, aMovedLab =
+ TDF_Label anAfterLab, aMovedLab =
std::dynamic_pointer_cast<Model_Data>(theMoved->data())->label().Father();
if (theAfterThis.get())
anAfterLab = std::dynamic_pointer_cast<Model_Data>(theAfterThis->data())->label().Father();
- Handle(TDataStd_HLabelArray1) aNewArray =
+ Handle(TDataStd_HLabelArray1) aNewArray =
new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper());
int aPassedMovedFrom = 0; // the prev feature location is found and passed
int aPassedMovedTo = 0; // the feature is added and this location is passed
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
std::string aResultGroup = featureResultGroup(aFeature);
if (!aResultGroup.empty()) {
- std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter =
+ std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter =
myHistory.find(aResultGroup);
if (aHIter != myHistory.end())
myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) {
FeaturePtr aFeature = feature(aRefs->Value(a));
if (aFeature.get()) {
- // if feature is in sub-component, remove it from history:
+ // if feature is in sub-component, remove it from history:
// it is in sub-tree of sub-component
bool isSub = ModelAPI_Tools::compositeOwner(aFeature).get() != NULL;
if (isFeature) { // here may be also disabled features
if (!isSub || theGroupID != ModelAPI_ResultConstruction::group()) {
// do not use reference to the list here since results can be changed by "isConcealed"
const std::list<std::shared_ptr<ModelAPI_Result> > aResults = aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator
aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRIter->get() && (*aRIter)->groupName() == theGroupID) {
if ((*aRIter)->data()->name() == theName)
return *aRIter;
- ResultCompSolidPtr aCompRes =
+ ResultCompSolidPtr aCompRes =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
if (aCompRes.get()) {
int aNumSubs = aCompRes->numberOfSubs();
}
void Model_Objects::synchronizeFeatures(
- const TDF_LabelList& theUpdated, const bool theUpdateReferences,
+ const TDF_LabelList& theUpdated, const bool theUpdateReferences,
const bool theOpen, const bool theFlush)
{
Model_Document* anOwner = std::dynamic_pointer_cast<Model_Document>(myDoc).get();
aFeature = std::dynamic_pointer_cast<Model_Session>(ModelAPI_Session::get())->createFeature(
TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get())
.ToCString(), anOwner);
- if (!aFeature.get()) {
+ if (!aFeature.get()) {
// somethig is wrong, most probably, the opened document has invalid structure
Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send();
aLabIter.Value()->Label().ForgetAllAttributes();
aKeptFeatures.insert(aFeature);
if (anUpdatedMap.Contains(aFeatureLabel)) {
if (!theOpen) { // on abort/undo/redo reinitialize attributes is something is changed
- std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
aFeature->data()->attributes("");
std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
for(; anAttr != anAttrs.end(); anAttr++)
updateHistory(aFeature);
aFeature->erase();
- // unbind after the "erase" call: on abort sketch
+ // unbind after the "erase" call: on abort sketch
// is removes sub-objects that corrupts aFIter
myFeatures.UnBind(aFIter.Key());
// reinitialize iterator because unbind may corrupt the previous order in the map
if (theUpdateReferences) {
synchronizeBackRefs();
}
- // update results of the features (after features created because
+ // update results of the features (after features created because
// they may be connected, like sketch and sub elements)
- // After synchronisation of back references because sketch
+ // After synchronisation of back references because sketch
// must be set in sub-elements before "execute" by updateResults
std::list<FeaturePtr> aComposites; // composites must be updated after their subs (issue 360)
TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
updateResults(*aComposite);
}
- // the synchronize should be done after updateResults
+ // the synchronize should be done after updateResults
// in order to correct back references of updated results
if (theUpdateReferences) {
synchronizeBackRefs();
if (theFlush) {
aLoop->flush(aDeleteEvent);
// delete should be emitted before create to reacts to aborted feature
- aLoop->flush(aCreateEvent);
+ aLoop->flush(aCreateEvent);
aLoop->flush(anUpdateEvent);
aLoop->flush(aCreateEvent); // after update of features, there could be results created
aLoop->flush(aDeleteEvent); // or deleted
/// synchronises back references for the given object basing on the collected data
void Model_Objects::synchronizeBackRefsForObject(const std::set<AttributePtr>& theNewRefs,
- ObjectPtr theObject)
+ ObjectPtr theObject)
{
if (!theObject.get() || !theObject->data()->isValid())
return; // invalid
std::set<AttributePtr>::iterator aCurrentIter = aData->refsToMe().begin();
while(aCurrentIter != aData->refsToMe().end()) {
if (theNewRefs.find(*aCurrentIter) == theNewRefs.end()) {
- // for external references from other documents this system
+ // for external references from other documents this system
// is not working: refs are collected from
- // different Model_Objects, so before remove check this
+ // different Model_Objects, so before remove check this
// external object exists and still referenced
bool aLeaveIt = false;
if ((*aCurrentIter)->owner().get() && (*aCurrentIter)->owner()->document() != myDoc &&
(*aRIter)->isConcealed();
}
}
- // the rest all refs means that feature references to the external document feature:
+ // the rest all refs means that feature references to the external document feature:
// process also them
std::map<ObjectPtr, std::set<AttributePtr> >::iterator anExtIter = allRefs.begin();
for(; anExtIter != allRefs.end(); anExtIter++) {
}
TDF_Label Model_Objects::resultLabel(
- const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex)
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex)
{
- const std::shared_ptr<Model_Data>& aData =
+ const std::shared_ptr<Model_Data>& aData =
std::dynamic_pointer_cast<Model_Data>(theFeatureData);
return aData->label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1);
}
theResult->init();
theResult->setDoc(myDoc);
initData(theResult, resultLabel(theFeatureData, theResultIndex), TAG_FEATURE_ARGUMENTS);
- if (theResult->data()->name().empty()) {
+ if (theResult->data()->name().empty()) {
// if was not initialized, generate event and set a name
std::stringstream aNewName;
aNewName<<theFeatureData->name();
- // if there are several results (issue #899: any number of result),
+ // if there are several results (issue #899: any number of result),
// add unique prefix starting from second
if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
aNewName<<"_"<<theResultIndex + 1;
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
- // for feature create compsolid, but for result sub create body:
+ // for feature create compsolid, but for result sub create body:
// only one level of recursion is supported now
ResultPtr aResultOwner = std::dynamic_pointer_cast<ModelAPI_Result>(theFeatureData->owner());
ObjectPtr anOldObject;
ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(*aResIter);
if (aBody.get()) {
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(aBody->data());
- if (!aData.get() || !aData->isValid() || (!aBody->isDisabled() && aData->isDeleted())) {
+ if (!aData.get() || !aData->isValid() || (!aBody->isDisabled() && aData->isDeleted())) {
// found a disappeared result => remove it
theFeature->eraseResultFromList(aBody);
// start iterate from beginning because iterator is corrupted by removing
TDF_Label anArgLab = aLabIter.Value();
Handle(TDataStd_Comment) aGroup;
if (anArgLab.FindAttribute(TDataStd_Comment::GetID(), aGroup)) {
- if (aGroup->Get() == ModelAPI_ResultBody::group().c_str() ||
+ if (aGroup->Get() == ModelAPI_ResultBody::group().c_str() ||
aGroup->Get() == ModelAPI_ResultCompSolid::group().c_str()) {
aNewBody = createBody(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
- std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
+ std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
theFeature->setResult(aNewP, aResIndex);
if (!aNewP->partDoc().get())
// create the part result: it is better to restore the previous result if it is possible
- theFeature->execute();
+ theFeature->execute();
break;
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
theFeature->execute(); // construction shapes are needed for sketch solver
public:
//! Registers the fieature in the data structure
//! \param theFeature feature that must be added to the data structure
- //! \param theAfterThis the feature will be added after this feature;
+ //! \param theAfterThis the feature will be added after this feature;
//! if it is null, the added feature will be the first
void addFeature(FeaturePtr theFeature, const FeaturePtr theAfterThis);
//! Returns the number of features in the group
int size(const std::string& theGroupID);
- //! Returns all (and disabled) results of the given type.
+ //! Returns all (and disabled) results of the given type.
//! Not fast method (iterates all features).
void allResults(const std::string& theGroupID, std::list<ResultPtr>& theResults);
//! Returns (creates if needed) the features label
TDF_Label featuresLabel() const;
- //! Initializes feature with a unique name in this group (unique name is generated as
+ //! Initializes feature with a unique name in this group (unique name is generated as
//! feature type + "_" + index
void setUniqueName(FeaturePtr theFeature);
//! Initializes the data fields of the feature
void initData(ObjectPtr theObj, TDF_Label theLab, const int theTag);
- //! Allows to store the result in the data tree of the document
+ //! Allows to store the result in the data tree of the document
//! (attaches 'data' of result to tree)
void storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
std::shared_ptr<ModelAPI_Result> theResult,
/// Returns true if theLater is in history of features creation later than theCurrent
bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const;
- /// Returns the result group identifier of the given feature (for this at least one result must
+ /// Returns the result group identifier of the given feature (for this at least one result must
/// be created before)
std::string featureResultGroup(FeaturePtr theFeature);
if (aResult) { // hidden unit must be redisplayed (hidden)
ModelAPI_EventCreator::get()->sendDeleted(document(), this->groupName());
// redisplay for the viewer (it must be disappeared also)
- static Events_ID EVENT_DISP =
+ static Events_ID EVENT_DISP =
Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), EVENT_DISP);
} else { // was not concealed become concealed => delete event
*/
class Model_ResultBody : public ModelAPI_ResultBody
{
- /// builders that tores the naming history: one per label to allow store several shapes to one
+ /// builders that tores the naming history: one per label to allow store several shapes to one
/// label; index in vector corresponds to the label tag
//std::vector<TNaming_Builder*> myBuilders;
theDefault = DEFAULT_COLOR();
}
-bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
const bool theFlag)
{
bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
if (aChanged) { // state is changed, so modifications are needed
myBuilder->evolutionToSelection(theFlag);
- updateSubs(shape()); // to set disabled/enabled
+ updateSubs(shape()); // to set disabled/enabled
}
return aChanged;
}
if (aResult) { // hidden unit must be redisplayed (hidden)
ModelAPI_EventCreator::get()->sendDeleted(document(), (*aSubIter)->groupName());
// redisplay for the viewer (it must be disappeared also)
- static Events_ID EVENT_DISP =
+ static Events_ID EVENT_DISP =
Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(*aSubIter, EVENT_DISP);
} else { // was not concealed become concealed => delete event
if (theValue) { // hidden unit must be redisplayed (hidden)
ModelAPI_EventCreator::get()->sendDeleted(document(), (*aSubIter)->groupName());
// redisplay for the viewer (it must be disappeared also)
- static Events_ID EVENT_DISP =
+ static Events_ID EVENT_DISP =
Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(*aSubIter, EVENT_DISP);
} else { // was not concealed become concealed => delete event
int Model_ResultConstruction::facesNum()
{
if (!myFacesUpToDate) {
- std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
+ std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(myShape);
if (aWirePtr.get()) {
std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
}
std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->document(DOC_REF());
-
+
// activation may cause changes in current features in document, so it must be in transaction
bool isNewTransaction = false;
SessionPtr aMgr = ModelAPI_Session::get();
- if (!aMgr->isOperation()) {
+ if (!aMgr->isOperation()) {
// open transaction even document is not created to set current docs in setActiveDocument
aMgr->startOperation("Activation");
isNewTransaction = true;
return std::dynamic_pointer_cast<ModelAPI_ResultPart>(data()->owner());
}
-bool Model_ResultPart::isActivated()
+bool Model_ResultPart::isActivated()
{
if (myTrsf.get()) {
if (!baseRef().get()) // may be on close
if (!aDoc.get()) // the part document is not presented for the moment
return "";
TDF_Label anAccessLabel = aDoc->generalLabel();
- // make the selection attribute anyway:
+ // make the selection attribute anyway:
// otherwise just by name it is not stable to search the result
std::string aName;
// for this the context result is needed
myTrsf.reset();
}
-void Model_ResultPart::setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
+void Model_ResultPart::setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
const std::shared_ptr<GeomAPI_Trsf>& theTransformation)
{
updateShape();
class Model_ResultPart : public ModelAPI_ResultPart
{
/// shape of this part created from bodies (updated only of Part deactivation)
- TopoDS_Shape myShape;
+ TopoDS_Shape myShape;
/// if it is just copy of original shape, keep just transformation
- std::shared_ptr<gp_Trsf> myTrsf;
+ std::shared_ptr<gp_Trsf> myTrsf;
public:
/// the reference to the base result document, may be null if this is the root,
/// Returns the part-document of this result
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> partDoc();
- /// Returns the original part result: for transfomration features results this is
+ /// Returns the original part result: for transfomration features results this is
/// the original Part feature result
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> original();
/// Updates the shape-result of the part (called on Part feature execution)
MODEL_EXPORT virtual void updateShape();
/// Applies the additional transformation of the part
- MODEL_EXPORT virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
+ MODEL_EXPORT virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
const std::shared_ptr<GeomAPI_Trsf>& theTransformation);
/// Returns the parameters of color definition in the resources config manager
ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext)
{
std::string aName;
- // add the result name to the name of the shape
+ // add the result name to the name of the shape
// (it was in BodyBuilder, but did not work on Result rename)
bool isNeedContextName = theContext->shape().get() != NULL;
// && !theContext->shape()->isEqual(theSubSh);
// check if the subShape is already in DF
Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theShape, myLab);
Handle(TDataStd_Name) anAttr;
- if(!aNS.IsNull() && !aNS->IsEmpty()) { // in the document
+ if(!aNS.IsNull() && !aNS->IsEmpty()) { // in the document
if(aNS->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) {
std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theContext->data());
// do nothing because this context name will be added later in this method
} else {
aName = TCollection_AsciiString(anAttr->Get()).ToCString();
- // indexes are added to sub-shapes not primitives
+ // indexes are added to sub-shapes not primitives
// (primitives must not be located at the same label)
if(!aName.empty() && aNS->Evolution() != TNaming_PRIMITIVE && isNeedContextName) {
const TDF_Label& aLabel = aNS->Label();//theDoc->findNamingName(aName);
const bool theAnotherDoc)
{
std::string aName("Undefined name");
- if(!theContext.get() || theContext->shape()->isNull())
+ if(!theContext.get() || theContext->shape()->isNull())
return !theDefaultName.empty() ? theDefaultName : aName;
-
+
// if it is in result of another part
- std::shared_ptr<Model_Document> aDoc =
+ std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(theContext->document());
if (theContext->groupName() == ModelAPI_ResultPart::group()) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theContext);
int anIndex;
if (theSubSh.get())
return aPart->data()->name() + "/" + aPart->nameInPart(theSubSh, anIndex);
- else
+ else
return aPart->data()->name();
}
BRepTools::Write(aContext, "Context.brep");
}
#endif
- aName = getShapeName(aDoc, aSubShape, theContext, theAnotherDoc,
+ aName = getShapeName(aDoc, aSubShape, theContext, theAnotherDoc,
theContext->shape()->isEqual(theSubSh));
if(aName.empty() ) { // not in the document!
TopAbs_ShapeEnum aType = aSubShape.ShapeType();
switch (aType) {
case TopAbs_FACE:
- // the Face should be in DF. If it is not the case, it is an error ==> to be debugged
+ // the Face should be in DF. If it is not the case, it is an error ==> to be debugged
break;
case TopAbs_EDGE:
{
// name structure: F1 & F2 [& F3 & F4],
// where F1 & F2 the faces which gives the Edge in trivial case
- // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
+ // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
if (BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) {
aName = "Degenerated_Edge";
break;
- }
+ }
TopTools_IndexedDataMapOfShapeListOfShape aMap;
TopExp::MapShapesAndAncestors(aContext, TopAbs_EDGE, TopAbs_FACE, aMap);
TopTools_IndexedMapOfShape aSMap; // map for ancestors of the sub-shape
if(aMap.Contains(aSubShape)) {
const TopTools_ListOfShape& anAncestors = aMap.FindFromKey(aSubShape);
// check that it is not a trivial case (F1 & F2: aNumber = 1)
- isTrivialCase = isTrivial(anAncestors, aSMap);
- } else
+ isTrivialCase = isTrivial(anAncestors, aSMap);
+ } else
break;
TopTools_ListOfShape aListOfNbs;
if(!isTrivialCase) { // find Neighbors
std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
if(i == 1)
aName = aFaceName;
- else
+ else
aName += "&" + aFaceName;
}
TopTools_ListIteratorOfListOfShape itl(aListOfNbs);
for (;itl.More();itl.Next()) {
std::string aFaceName = getShapeName(aDoc, itl.Value(), theContext, theAnotherDoc, false);
aName += "&" + aFaceName;
- }
+ }
}
break;
case TopAbs_VERTEX:
- // name structure (Monifold Topology):
+ // name structure (Monifold Topology):
// 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
- // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition,
+ // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition,
// but it should be kept as is to obtain safe recomputation
// 2) F1 | F2 - intersection of 2 faces definses a vertex - applicable for case
// when 1 faces is cylindrical, conical, spherical or revolution and etc.
// 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
// or compound of 2 open faces.
- // 4) E1 | E2 - intesection of 2 edges defines a vertex - when we have a case of
+ // 4) E1 | E2 - intesection of 2 edges defines a vertex - when we have a case of
// two independent edges (wire or compound)
// implemented 2 first cases
{
}
if(i == 1)
aName = anEdgeName;
- else
+ else
aName += "&" + anEdgeName;
}
}//reg
else { // dangle vertex: if(aList22.Extent() == 1)
//it should be already in DF
}
- }
+ }
if (isByFaces) {
TopTools_ListIteratorOfListOfShape itl(aList);
for (int i = 1;itl.More();itl.Next(),i++) {
std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
if(i == 1)
aName = aFaceName;
- else
+ else
aName += "&" + aFaceName;
}
}
}
if (aShapeTypes.find(theType) != aShapeTypes.end())
return aShapeTypes[theType];
- Events_InfoMessage("Model_SelectionNaming",
+ Events_InfoMessage("Model_SelectionNaming",
"Shape type defined in XML is not implemented!").send();
return TopAbs_SHAPE;
}
const std::string& theSubShapeName, Handle(TNaming_NamedShape) theNS)
{
TopoDS_Shape aSelection;
- std::string::size_type n = theSubShapeName.rfind('/');
+ std::string::size_type n = theSubShapeName.rfind('/');
if (n == std::string::npos) n = -1;
std::string aSubString = theSubShapeName.substr(n + 1);
n = aSubString.rfind('_');
int indx = 1;
- if (n != std::string::npos) {// for primitives this is a first
+ if (n != std::string::npos) {// for primitives this is a first
// if we have here the same name as theSubShapeName, there is no index in compound, it is whole
Handle(TDataStd_Name) aName;
if (!theNS->Label().FindAttribute(TDataStd_Name::GetID(), aName) ||
return anItL.NewShape();
}
}
- return aSelection;
+ return aSelection;
}
const TopoDS_Shape findFaceByName(
const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc)
{
TopoDS_Shape aFace;
- //std::string::size_type n, nb = theSubShapeName.rfind('/');
+ //std::string::size_type n, nb = theSubShapeName.rfind('/');
//if (nb == std::string::npos) nb = 0;
//std::string aSubString = theSubShapeName.substr(nb + 1);
std::string aSubString = theSubShapeName;
size_t n1(0), n2(0); // n1 - start position, n2 - position of the delimiter
while ((n2 = aName.find('&', n1)) != std::string::npos) {
const std::string aName1 = aName.substr(n1, n2 - n1); //name of face
- theList.push_back(aName1);
+ theList.push_back(aName1);
n1 = n2 + 1;
aLastName = aName.substr(n1);
}
//fill maps
TopTools_ListIteratorOfListOfShape it(theList);
for(int i = 0;it.More();it.Next(),i++) {
- const TopoDS_Shape& aFace = it.Value();
+ const TopoDS_Shape& aFace = it.Value();
if(i < 2) {
TopExp_Explorer anExp (aFace, theType);
for(;anExp.More();anExp.Next()) {
aShape = it2.Key();
if(theList.Extent() == 2)
break;
- else
+ else
aList.Append(it2.Key());
}
}
- if(aList.Extent() && aVec.size() > 3) {// list of common edges ==> search ny neighbors
+ if(aList.Extent() && aVec.size() > 3) {// list of common edges ==> search ny neighbors
if(aVec[2].Extent() && aVec[3].Extent()) {
TopTools_ListIteratorOfListOfShape it(aList);
for(;it.More();it.Next()) {
std::string getContextName(const std::string& theSubShapeName)
{
std::string aName;
- std::string::size_type n = theSubShapeName.find('/');
+ std::string::size_type n = theSubShapeName.find('/');
if (n == std::string::npos) return theSubShapeName;
aName = theSubShapeName.substr(0, n);
return aName;
}
-/// Parses naming name of sketch sub-elements: takes indices and orientation
-/// (if theOriented = true) from this name. Map theIDs constains indices ->
+/// Parses naming name of sketch sub-elements: takes indices and orientation
+/// (if theOriented = true) from this name. Map theIDs constains indices ->
/// orientations and start/end vertices: negative is reversed, 2 - start, 3 - end
bool parseSubIndices(CompositeFeaturePtr theComp, //< to iterate names
- const std::string& theName, const char* theShapeType,
+ const std::string& theName, const char* theShapeType,
std::map<int, int>& theIDs, const bool theOriented = false)
{
// collect all IDs in the name
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
// there may be many shapes (circle and center)
for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (aConstr.get()) {
aNames[Model_SelectionNaming::shortName(aConstr)] = theComp->subFeatureId(a);
{
if (theContext.ShapeType() != TopAbs_FACE && theContext.ShapeType() != TopAbs_WIRE)
return 0;
- if (theEdge.Orientation() == TopAbs_FORWARD)
+ if (theEdge.Orientation() == TopAbs_FORWARD)
return 1;
- if (theEdge.Orientation() == TopAbs_REVERSED)
+ if (theEdge.Orientation() == TopAbs_REVERSED)
return -1;
return 0; // unknown
}
std::shared_ptr<GeomAPI_Shape> Model_SelectionNaming::findAppropriateFace(
- std::shared_ptr<ModelAPI_Result>& theConstr,
+ std::shared_ptr<ModelAPI_Result>& theConstr,
NCollection_DataMap<Handle(Geom_Curve), int>& theCurves, const bool theIsWire)
{
int aBestFound = 0; // best number of found edges (not percentage: issue 1019)
int aBestOrient = 0; // for the equal "BestFound" additional parameter is orientation
std::shared_ptr<GeomAPI_Shape> aResult;
- ResultConstructionPtr aConstructionContext =
+ ResultConstructionPtr aConstructionContext =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theConstr);
if (!aConstructionContext.get())
return aResult;
for(int aFaceIndex = 0; aFaceIndex < aConstructionContext->facesNum(); aFaceIndex++) {
int aFound = 0, aNotFound = 0, aSameOrientation = 0;
- TopoDS_Face aFace =
+ TopoDS_Face aFace =
TopoDS::Face(aConstructionContext->face(aFaceIndex)->impl<TopoDS_Shape>());
std::list<TopoDS_Shape> aFacesWires; // faces or wires to iterate
if (theIsWire) {
}
}
if (aFound + aNotFound != 0) {
- if (aFound > aBestFound ||
+ if (aFound > aBestFound ||
(aFound == aBestFound && aSameOrientation > aBestOrient)) {
aBestFound = aFound;
aBestOrient = aSameOrientation;
}
// type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT
-bool Model_SelectionNaming::selectSubShape(const std::string& theType,
+bool Model_SelectionNaming::selectSubShape(const std::string& theType,
const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc,
std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected, std::shared_ptr<ModelAPI_Result>& theCont)
{
}
}
}
- if (aDoc != theDoc) {
+ if (aDoc != theDoc) {
// so, the first word is the document name => reduce the string for the next manips
aSubShapeName = theSubShapeName.substr(aSlash + 1);
if (aSubShapeName.empty() && aFoundPart.get()) { // the whole Part result
// possible this is body where postfix is added to distinguish several shapes on the same label
int aSubShapeId = -1; // -1 means sub shape not found
// for result body the name wihtout "_" has higher priority than with it: it is always added
- if ((!aCont.get()/* || (aCont->groupName() == ModelAPI_ResultBody::group())*/) &&
+ if ((!aCont.get()/* || (aCont->groupName() == ModelAPI_ResultBody::group())*/) &&
aContName == aSubShapeName) {
size_t aPostIndex = aContName.rfind('_');
if (aPostIndex != std::string::npos) {
TopoDS_Shape aSelection;
- switch (aType)
+ switch (aType)
{
case TopAbs_FACE:
case TopAbs_WIRE:
}
break;
case TopAbs_EDGE:
- {
+ {
const TDF_Label& aLabel = aDoc->findNamingName(aSubShapeName);
if(!aLabel.IsNull()) {
Handle(TNaming_NamedShape) aNS;
case TopAbs_SOLID:
case TopAbs_SHELL:
default: {//TopAbs_SHAPE
- /// case when the whole sketch is selected, so,
+ /// case when the whole sketch is selected, so,
/// selection type is compound, but there is no value
if (aCont.get() && aCont->shape().get()) {
if (aCont->shape()->impl<TopoDS_Shape>().ShapeType() == aType) {
for(; it != aListofNames.end(); it++){
const TopoDS_Shape aFace = findFaceByName(*it, aDoc);
if(!aFace.IsNull())
- aList.Append(aFace);
+ aList.Append(aFace);
}
aSelection = findCommonShape(aType, aList);
}
return true;
}
// for sketch sub-elements selected
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aConstr));
if (aComposite.get()) {
if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE) {
// collect all IDs in the name
std::map<int, int> anIDs;
- if (!parseSubIndices(aComposite, aSubShapeName,
+ if (!parseSubIndices(aComposite, aSubShapeName,
aType == TopAbs_EDGE ? "Edge" : "Vertex", anIDs))
return false;
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIt = aResults.cbegin();
// there may be many shapes (circle and center)
for(; aRIt != aResults.cend(); aRIt++) {
- ResultConstructionPtr aRes =
+ ResultConstructionPtr aRes =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRIt);
if (aRes) {
int anOrientation = abs(anIDs[aCompID]);
// sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
} else if (aType == TopAbs_FACE || aType == TopAbs_WIRE) {
std::map<int, int> anIDs;
- if (!parseSubIndices(aComposite, aSubShapeName,
+ if (!parseSubIndices(aComposite, aSubShapeName,
aType == TopAbs_FACE ? "Face" : "Wire", anIDs, true))
return false;
// curves and orientations of edges
- NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
+ NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
int aSubID = aComposite->subFeatureId(a);
const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (aConstr->shape() && aConstr->shape()->isEdge()) {
const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
theShapeToBeSelected = aFoundFW;
return true;
}
- } else if (aType == TopAbs_WIRE) {
+ } else if (aType == TopAbs_WIRE) {
// sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
std::map<int, int> anIDs;
if (!parseSubIndices(aComposite, aSubShapeName, "Wire", anIDs))
const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
+ ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (aConstr->shape() && aConstr->shape()->isEdge()) {
const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
}
}
}
- std::shared_ptr<GeomAPI_Shape> aFoundFW =
+ std::shared_ptr<GeomAPI_Shape> aFoundFW =
findAppropriateFace(aConstr, allCurves, aType == TopAbs_WIRE);
if (aFoundFW.get()) {
theShapeToBeSelected = aFoundFW;
}
}
if (!aSelection.IsNull()) {
- // Select it (must be after N=0 checking,
+ // Select it (must be after N=0 checking,
// since for simple constructions the shape must be null)
std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelection));
/// Produces the string-name for the selected shape
std::string namingName(ResultPtr& theContext, std::shared_ptr<GeomAPI_Shape> theSubSh,
const std::string& theDefaultName, const bool theAnotherDoc);
-
+
/// Makes a selection by the string-name
/// \param theType string of the type of the shape
/// \param theSubShapeName string-identifier of the selected shape
std::shared_ptr<Model_Document> theDoc, std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected,
std::shared_ptr<ModelAPI_Result>& theCont);
- /// Searches the face more appropriate to the given curves
+ /// Searches the face more appropriate to the given curves
/// (with higher level of matched parameters)
/// \param theConstr construction result that contains one or several faces
- /// \param theCurves map from the face edges curves to orientation
+ /// \param theCurves map from the face edges curves to orientation
/// (-1 reversed, 0 unknown, 1 forward)
- /// \param theIsWire for wire algorithm isquite the same,
+ /// \param theIsWire for wire algorithm isquite the same,
/// but if in face several wires, it returns the needed wire
/// \returns faces fron this construction if found
static std::shared_ptr<GeomAPI_Shape> findAppropriateFace(
- std::shared_ptr<ModelAPI_Result>& theConstr,
+ std::shared_ptr<ModelAPI_Result>& theConstr,
NCollection_DataMap<Handle(Geom_Curve), int>& theCurves, const bool theIsWire);
/// Returns orientation of the edge in the context shape
Handle(Model_Application) anApp = Model_Application::getApplication();
bool aFirstCall = !anApp->hasRoot();
if (aFirstCall) {
- // to be sure that plugins are loaded,
+ // to be sure that plugins are loaded,
// even before the first "createFeature" call (in unit tests)
LoadPluginsInfo();
// creation of the root document is always outside of the transaction, so, avoid checking it
ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session>(this));
// register the configuration reading listener
Events_Loop* aLoop = Events_Loop::loop();
- static const Events_ID kFeatureEvent =
+ static const Events_ID kFeatureEvent =
Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
aLoop->registerListener(this, kFeatureEvent);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), 0, true);
void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- static const Events_ID kFeatureEvent =
+ static const Events_ID kFeatureEvent =
Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
static const Events_ID kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
if (theMessage->eventID() == kFeatureEvent) {
- const std::shared_ptr<Config_FeatureMessage> aMsg =
+ const std::shared_ptr<Config_FeatureMessage> aMsg =
std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (aMsg) {
aMsg->pluginLibrary(), aMsg->documentKind());
}
} else {
- const std::shared_ptr<Config_AttributeMessage> aMsgAttr =
+ const std::shared_ptr<Config_AttributeMessage> aMsgAttr =
std::dynamic_pointer_cast<Config_AttributeMessage>(theMessage);
if (aMsgAttr) {
// plugins information was started to load, so, it will be loaded
myPluginsInfoLoaded = true;
} else if (theMessage->eventID() == kValidatorEvent) {
- std::shared_ptr<Config_ValidatorMessage> aMsg =
+ std::shared_ptr<Config_ValidatorMessage> aMsg =
std::dynamic_pointer_cast<Config_ValidatorMessage>(theMessage);
if (aMsg) {
if (aMsg->attributeId().empty()) { // feature validator
if (theMessage->eventID() == kDeletedEvent) {
std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleted =
std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
- if (aDeleted &&
+ if (aDeleted &&
aDeleted->groups().find(ModelAPI_ResultPart::group()) != aDeleted->groups().end())
{
// check that the current feature of the session is still the active Part (even disabled)
{
bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
/// map of feature IDs to plugin name and document kind
- std::map<std::string, std::pair<std::string, std::string> > myPlugins;
+ std::map<std::string, std::pair<std::string, std::string> > myPlugins;
std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
-
+
/// if true, generates error if document is updated outside of transaction
- bool myCheckTransactions;
+ bool myCheckTransactions;
bool myOperationAttachedToNext; ///< the current operation must be committed twice, with nested
public:
//! Starts a new operation (opens a transaction)
//! \param theId string-identifier of the started transaction
- //! \param theAttachedToNested if it is true,
- //! it means that this transaction is attached to the nested
+ //! \param theAttachedToNested if it is true,
+ //! it means that this transaction is attached to the nested
//! where it is located and will be committed on the next commit with the nested
MODEL_EXPORT virtual void startOperation(
const std::string& theId = "", const bool theAttachedToNested = false);
//! Finishes the previously started operation (closes the transaction)
MODEL_EXPORT virtual void finishOperation();
- //! Aborts the operation
+ //! Aborts the operation
MODEL_EXPORT virtual void abortOperation();
//! Returns true if operation has been started, but not yet finished or aborted
MODEL_EXPORT virtual bool isOperation();
MODEL_EXPORT virtual bool isLoadByDemand(const std::string theDocID);
/// Registers the plugin that creates features.
- /// It is obligatory for each plugin to call this function on loading to be found by
+ /// It is obligatory for each plugin to call this function on loading to be found by
/// the plugin manager on call of the feature)
MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin);
if (theFeature->data()->execState() == ModelAPI_StateDone ||
theFeature->data()->execState() == ModelAPI_StateExecFailed) // fix issue 1819
theFeature->data()->execState(ModelAPI_StateMustBeUpdated);
- else
+ else
return true; // do not need iteration deeply if it is already marked as modified or so
#ifdef DEB_UPDATE
//std::cout<<"*** Set modified state "<<theFeature->name()<<std::endl;
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
updateSelection(aMsg->objects());
}
- // creation is added to "update" to avoid recomputation twice:
+ // creation is added to "update" to avoid recomputation twice:
// on create and immediately after on update
if (theMessage->eventID() == kCreatedEvent) {
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
for(; anObjIter != anObjs.cend(); anObjIter++) {
if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())->executeFeatures()) {
- if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) {
+ if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) {
// results creation means enabling, not update
ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent);
} else {
if (anUpdated.get()) {
if (addModified(anUpdated, FeaturePtr()))
aSomeModified = true;
- } else {
+ } else {
// process the updated result as update of features that refers to this result
- const std::set<std::shared_ptr<ModelAPI_Attribute> >&
+ const std::set<std::shared_ptr<ModelAPI_Attribute> >&
aRefs = (*anObjIter)->data()->refsToMe();
std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.cbegin();
for(; aRefIter != aRefs.cend(); aRefIter++) {
myIsFinish = false;
}
// processed features must be only on finish, so clear anyway (to avoid reimport on load)
- myProcessOnFinish.clear();
+ myProcessOnFinish.clear();
if (!(theMessage->eventID() == kOpStartEvent)) {
processFeatures(false);
anUpdatedIter++;
}
}
- // the redisplay signal should be flushed in order
+ // the redisplay signal should be flushed in order
// to erase the feature presentation in the viewer
// if should be done after removeFeature() of document,
// by this reason, upper processFeatures() do not perform this flush
myIsParamUpdated = false;
myWaitForFinish.clear();
} else if (theMessage->eventID() == kReorderEvent) {
- std::shared_ptr<ModelAPI_OrderUpdatedMessage> aMsg =
+ std::shared_ptr<ModelAPI_OrderUpdatedMessage> aMsg =
std::dynamic_pointer_cast<ModelAPI_OrderUpdatedMessage>(theMessage);
if (aMsg->reordered().get())
addModified(aMsg->reordered(), aMsg->reordered()); // to update all attributes
myProcessed[theFeature] = 0;
} else {
int aCount = myProcessed[theFeature];
- if (aCount > 100) {
+ if (aCount > 100) {
// too many repetition of processing (in VS it may crash on 330 with stack overflow)
Events_InfoMessage("Model_Update",
"Feature '%1' is updated in infinitive loop").arg(theFeature->data()->name()).send();
aIsModified = true;
std::set<std::shared_ptr<ModelAPI_Feature> > aNewSet;
// contains itself, so, we don't know which was the reason and the reason is any
- aNewSet.insert(theFeature);
+ aNewSet.insert(theFeature);
myModified[theFeature] = aNewSet;
}
}
return false;
}
- // evaluate parameter before the sub-elements update:
+ // evaluate parameter before the sub-elements update:
// it updates dependencies on evaluation (#1085)
if (theFeature->getKind() == "Parameter") {
theFeature->execute();
// check all features this feature depended on (recursive call of updateFeature)
std::set<FeaturePtr>& aReasons = myModified[theFeature];
bool allSubsUsed = aReasons.find(theFeature) != aReasons.end();
- if (allSubsUsed) {
+ if (allSubsUsed) {
// add all subs in aReasons and temporary remove "theFeature" to avoid processing itself
allReasons(theFeature, aReasons);
aReasons.erase(theFeature);
}
- // take reasons one by one (they may be added during the feature process
+ // take reasons one by one (they may be added during the feature process
// (circle by the radius of sketch)
std::set<FeaturePtr> aProcessedReasons;
while(!aReasons.empty()) {
bool isPostponedMain = false;
CompositeFeaturePtr aCompos = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
if (theFeature->getKind() == "ExtrusionSketch" && aCompos.get()) {
- CompositeFeaturePtr aCurrentOwner =
+ CompositeFeaturePtr aCurrentOwner =
ModelAPI_Tools::compositeOwner(theFeature->document()->currentFeature(false));
isPostponedMain = aCurrentOwner.get() && aCompos->isSub(aCurrentOwner);
}
// this checking must be after the composite feature sub-elements processing:
// composite feature status may depend on it's subelements
- if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) &&
- theFeature->getKind() != "Part") {
+ if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) &&
+ theFeature->getKind() != "Part") {
// don't disable Part because it will make disabled all the features
// (performance and problems with the current feature)
#ifdef DEB_UPDATE
for (; aRIter != allResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
if (!aRes->isDisabled()) {
- // update state only for enabled results
+ // update state only for enabled results
// (Placement Result Part may make the original Part Result as invalid)
aRes->data()->execState(theState);
}
for(; anIter != anAttributes.end(); anIter++) {
AttributePointPtr aPointAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point>(*anIter);
- if (aPointAttribute.get() && (!aPointAttribute->textX().empty() ||
+ if (aPointAttribute.get() && (!aPointAttribute->textX().empty() ||
!aPointAttribute->textY().empty() || !aPointAttribute->textZ().empty())) {
if (myIsParamUpdated) {
ModelAPI_AttributeEvalMessage::send(aPointAttribute, this);
AttributePoint2DPtr aPoint2DAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
if (aPoint2DAttribute.get()) {
- if (myIsParamUpdated && (!aPoint2DAttribute->textX().empty() ||
+ if (myIsParamUpdated && (!aPoint2DAttribute->textX().empty() ||
!aPoint2DAttribute->textY().empty())) {
ModelAPI_AttributeEvalMessage::send(aPoint2DAttribute, this);
}
}
}
// update the selection attributes if any
- list<AttributePtr> aRefs =
+ list<AttributePtr> aRefs =
theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
list<AttributePtr>::iterator aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
theFeature->data()->execState(aState);
}
-bool Model_Update::isReason(std::shared_ptr<ModelAPI_Feature>& theFeature,
- std::shared_ptr<ModelAPI_Object> theReason)
+bool Model_Update::isReason(std::shared_ptr<ModelAPI_Feature>& theFeature,
+ std::shared_ptr<ModelAPI_Object> theReason)
{
std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
::iterator aReasonsIt = myModified.find(theFeature);
}
// this case only for not-previewed items update state, nothing is changed in args for it
- return false;
+ return false;
}
void Model_Update::executeFeature(FeaturePtr theFeature)
Events_InfoMessage("Model_Update",
"Feature %1 has failed during the execution").arg(theFeature->getKind()).send();
}
- // The macro feature has to be deleted in any case even its execution is failed
+ // The macro feature has to be deleted in any case even its execution is failed
myWaitForFinish.insert(theFeature);
if (aState != ModelAPI_StateDone) {
theFeature->eraseResults();
bool added = false; // object may be was crated
ModelAPI_Object* aSender = static_cast<ModelAPI_Object*>(theSender);
if (aSender && aSender->document()) {
- FeaturePtr aFeatureSender =
+ FeaturePtr aFeatureSender =
std::dynamic_pointer_cast<ModelAPI_Feature>(aSender->data()->owner());
if (aFeatureSender.get()) {
- Model_Objects* aDocObjects =
+ Model_Objects* aDocObjects =
std::dynamic_pointer_cast<Model_Document>(aSender->document())->objects();
if (aDocObjects) {
//aDocObjects->synchronizeBackRefs();
aRefIt = aRefs.begin();
for(; aRefIt != aRefs.end(); aRefIt++) {
if (!aFactory->isConcealed(aFeatureSender->getKind(), aRefIt->first))
- // take into account only concealed references
+ // take into account only concealed references
// (do not remove the sketch constraint and the edge on constraint edit)
- continue;
+ continue;
std::list<ObjectPtr>& aRefFeaturesList = aRefIt->second;
std::list<ObjectPtr>::iterator aReferenced = aRefFeaturesList.begin();
for(; aReferenced != aRefFeaturesList.end(); aReferenced++) {
- // stability is only on results: feature to feature reference mean nested
+ // stability is only on results: feature to feature reference mean nested
// features, that will remove nesting references
- if (aReferenced->get() && (*aReferenced)->data()->isValid() &&
+ if (aReferenced->get() && (*aReferenced)->data()->isValid() &&
(*aReferenced)->groupName() != ModelAPI_Feature::group()) {
- std::shared_ptr<Model_Data> aData =
+ std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>((*aReferenced)->data());
if (aFeatureSender->isStable()) {
aData->addBackReference(aFeatureSender, aRefIt->first);
{
std::set<std::shared_ptr<ModelAPI_Object> >::iterator anObj = theObjects.begin();
for(; anObj != theObjects.end(); anObj++) {
- list<AttributePtr> aRefs =
+ list<AttributePtr> aRefs =
(*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId());
list<AttributePtr>::iterator aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
myModified;
/// Features which arguments were modified by not-persistent changes.
- /// So, these referencing arguments must be updated
+ /// So, these referencing arguments must be updated
/// due to these features info also before execution).
std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
myNotPersistentRefs;
std::set<std::shared_ptr<ModelAPI_Feature> > myProcessOnFinish;
/// to avoid infinitive cycling: feature -> count of the processing periods during this update
std::map<std::shared_ptr<ModelAPI_Feature>, int > myProcessed;
- /// if preview in hte property panel is blocked and
+ /// if preview in hte property panel is blocked and
/// any update is postponed until the end of operation
bool myIsPreviewBlocked;
void updateArguments(std::shared_ptr<ModelAPI_Feature> theFeature);
/// Sends the redisplay events for feature and results, updates the updated status
- void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
+ void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
const ModelAPI_ExecState theState);
/// On operation start/end/abort the "Just" fileds must be cleared and processed in the right way
/// Updates the properties of object because of stability state changes
void updateStability(void* theSender);
- /// Returns true if theFeature modification was caused by theReason
+ /// Returns true if theFeature modification was caused by theReason
/// (may be feature of result of this feature)
bool isReason(
std::shared_ptr<ModelAPI_Feature>& theFeature, std::shared_ptr<ModelAPI_Object> theReason);
myFeatures[theFeatureID] = AttrValidators();
}
if (myFeatures[theFeatureID].find(theID) != myFeatures[theFeatureID].end()) {
- //Events_Error::send(std::string("Validator ") + theID +
+ //Events_Error::send(std::string("Validator ") + theID +
// " for feature " + theFeatureID + "is already registered");
} else {
myFeatures[theFeatureID][theID] = std::list<std::string>();
}
if (myFeatures[theFeatureID].find(theID) != myFeatures[theFeatureID].end()) {
- //Events_Error::send(std::string("Validator ") + theID +
+ //Events_Error::send(std::string("Validator ") + theID +
// " for feature " + theFeatureID + "is already registered");
} else {
myFeatures[theFeatureID][theID] = theArguments;
void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
Validators& theValidators) const
{
- std::map<std::string, AttrValidators>::const_iterator aFeatureIt =
+ std::map<std::string, AttrValidators>::const_iterator aFeatureIt =
myFeatures.find(theFeatureID);
if (aFeatureIt != myFeatures.cend()) {
AttrValidators::const_iterator aValidatorsIt = aFeatureIt->second.cbegin();
addDefaultValidators(theValidators);
}
-void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
+void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
const std::string& theAttrID,
Validators& theValidators) const
{
- std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeatureIt =
+ std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeatureIt =
myAttrs.find(theFeatureID);
if (aFeatureIt != myAttrs.cend()) {
std::map<std::string, AttrValidators>::const_iterator anAttrIt =
// Events_Error::send(std::string("Validator ") + aValidatorID + " was not registered");
// continue;
//}
- const ModelAPI_FeatureValidator* aFValidator =
+ const ModelAPI_FeatureValidator* aFValidator =
dynamic_cast<const ModelAPI_FeatureValidator*>(validator(aValidatorID));
if (aFValidator) {
Events_InfoMessage anError;
//std::map<std::string, ModelAPI_Validator*>::const_iterator aDefaultVal = myIDs.find(kDefaultId);
//if(aDefaultVal != myIDs.end()) {
// static const std::list<std::string> anEmptyArgList;
- // const ModelAPI_FeatureValidator* aFValidator =
+ // const ModelAPI_FeatureValidator* aFValidator =
// dynamic_cast<const ModelAPI_FeatureValidator*>(aDefaultVal->second);
// if (aFValidator) {
// std::string anError;
std::list<std::string> aLtAttributes = aData->attributesIDs(kAllTypes);
std::list<std::string>::const_iterator anAttrIt = aLtAttributes.cbegin();
for (; anAttrIt != aLtAttributes.cend(); anAttrIt++) {
- const std::string& anAttributeID = *anAttrIt;
+ const std::string& anAttributeID = *anAttrIt;
AttributePtr anAttribute = theFeature->data()->attribute(anAttributeID);
std::string aValidatorID;
theFeature->setError(anError.messageString(), false);
theFeature->data()->execState(ModelAPI_StateInvalidArgument);
return false;
- }
+ }
}
return true;
if (!anAttrValidator->isValid(theAttribute, anArguments, theError)) {
theValidator = aValidatorID;
return false;
- }
+ }
}
return true;
}
-void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature,
+void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature,
std::string theAttribute)
{
const static std::string kDefaultId = "Model_FeatureValidator";
std::map<std::string, AttrValidators> myFeatures;
/// validators IDs and arguments by feature and attribute IDs
std::map<std::string, std::map<std::string, AttrValidators> > myAttrs;
- /// Stores the registered attributes that leads to the concealment of referenced objects in
+ /// Stores the registered attributes that leads to the concealment of referenced objects in
/// data tree. Map from feature kind to set of attribute IDs.
std::map<std::string, std::set<std::string> > myConcealed;
/// Stored the unconcealed results and features that caused the canceled concealment (Recover).
std::map<std::shared_ptr<ModelAPI_Result>, std::list<std::shared_ptr<ModelAPI_Feature> > >
myUnconcealed;
/// Stores the registered attributes must be checked only if the particular case is activated
- /// Map from feature kind to map of attribute IDs to pair
+ /// Map from feature kind to map of attribute IDs to pair
// (switchId (ID of the attribute) and case Ids (possible values of the switch attribute))
std::map<std::string, std::map<std::string,
std::map<std::string, std::set<std::string> > > > myCases;
MODEL_EXPORT virtual void validators(const std::string& theFeatureID,
Validators& theResult) const;
/// Provides a validator for the attribute, returns NULL if no validator
- MODEL_EXPORT virtual void validators(const std::string& theFeatureID,
+ MODEL_EXPORT virtual void validators(const std::string& theFeatureID,
const std::string& theAttrID, Validators& theResult) const;
/// Returns registered validator by its Id
bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock)
{
bool aBlocked = mySetInitializedBlocked;
-
+
mySetInitializedBlocked = theBlock;
return aBlocked;
/// \return the previous block value
MODELAPI_EXPORT bool blockSetInitialized(const bool theBlock);
- /// Set this attribute is argument for result
+ /// Set this attribute is argument for result
/// (change of this attribute requires update of result).
/// By default it is true.
MODELAPI_EXPORT void setIsArgument(const bool theFlag);
MODELAPI_EXPORT virtual std::string expressionError() = 0;
/// Defines the used parameters
- MODELAPI_EXPORT virtual
+ MODELAPI_EXPORT virtual
void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
MODELAPI_EXPORT virtual std::string expressionError() = 0;
/// Defines the used parameters
- MODELAPI_EXPORT virtual
+ MODELAPI_EXPORT virtual
void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
virtual void generated(
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
const int theTag = 1) = 0;
/// Records the shape newShape which was generated from the shape oldShape during a topological
- /// construction. As an example, consider the case of a face generated from an edge in
+ /// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
const int theTag = 1) = 0;
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
const int theTag = 1) = 0;
/// Records the shape oldShape which was deleted from the current label.
/// As an example, consider the case of a face removed by a Boolean operation.
virtual void deleted(
const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
-
+
/// load deleted shapes
virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
/// load shapes of the first level (to be used during shape import)
- virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
+ virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag) = 0;
-
+
/// load disconnected edges
- virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
+ virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag) = 0;
/// load disconnected vetexes
- virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
+ virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName,int& theTag) = 0;
- /// Converts evolution of sub-shapes stored in naming structure to selection
+ /// Converts evolution of sub-shapes stored in naming structure to selection
/// (theFlag = true) and back (theFlag = false)
virtual void evolutionToSelection(const bool theFlag) = 0;
#ifndef ModelAPI_Data_H_
#define ModelAPI_Data_H_
-#ifdef _WINDOWS // to avoid too long decorated name warning
+#ifdef _WINDOWS // to avoid too long decorated name warning
#pragma warning( disable : 4503 )
#endif
/// Returns the attribute that contains selection to a shape
virtual std::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID) = 0;
/// Returns the attribute that contains selection to a shape
- virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
+ virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
selectionList(const std::string& theID) = 0;
/// Returns the attribute that contains reference to an attribute of a feature
virtual std::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID) = 0;
virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >& refsToMe() = 0;
/// returns all references by attributes of this data
- /// \param theRefs returned list of pairs: id of referenced attribute and
+ /// \param theRefs returned list of pairs: id of referenced attribute and
/// list of referenced objects
virtual void referencesToObjects(
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >& theRefs) =0;
//! Adds to the document the new feature of the given feature id
//! \param theID creates feature and puts it in the document (if it is not action)
//! \param theMakeCurrent to make current this new feature in this document
- virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID,
+ virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID,
const bool theMakeCurrent = true) = 0;
//! Return a list of features, which refers to the feature
virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
//! Moves the feature to make it after the given one in the history.
- virtual void moveFeature(std::shared_ptr<ModelAPI_Feature> theMoved,
+ virtual void moveFeature(std::shared_ptr<ModelAPI_Feature> theMoved,
std::shared_ptr<ModelAPI_Feature> theAfterThis) = 0;
///! Returns the id of the document
virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex) = 0;
//! Performs synchronization of transactions with the module document:
//! If some document is not active (by undo of activation) but in memory,
- //! on activation the transactions must be synchronised because all redos performed
+ //! on activation the transactions must be synchronised because all redos performed
//! wihtout this participation
virtual void synchronizeTransactions() = 0;
const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
/// Returns true if theLater is in history of features creation later than theCurrent
- virtual bool isLater(std::shared_ptr<ModelAPI_Feature> theLater,
+ virtual bool isLater(std::shared_ptr<ModelAPI_Feature> theLater,
std::shared_ptr<ModelAPI_Feature> theCurrent) const = 0;
//! Internally makes document know that feature was removed or added in history after creation
// ===== ModelAPI_SolverFailedMessage =====
-ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID,
+ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID,
const void* theSender)
: Events_Message(theID, theSender),
myDOF(-1)
/// The active document becomes another one
static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged";
-/// Event ID that order of objects in group is changed,
+/// Event ID that order of objects in group is changed,
/// so, tree must be fully rectreated (movement of feature)
static const char * EVENT_ORDER_UPDATED = "OrderUpdated";
/// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed
class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message
{
protected:
- /// Creates a message:
+ /// Creates a message:
ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender = 0);
/// The virtual destructor
virtual ~ModelAPI_OrderUpdatedMessage();
MODELAPI_EXPORT virtual std::string error() = 0;
/// Defines the used parameters (by the parameters listener)
- MODELAPI_EXPORT virtual
+ MODELAPI_EXPORT virtual
void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
public:
/// Reference to the color of the result.
- /// The integer array is used. It contains tree values for red green and blue values.
+ /// The integer array is used. It contains tree values for red green and blue values.
/// The values are in [0, 255] range
inline static const std::string& COLOR_ID()
{
MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue);
/// Enables/disables the result. The disabled result does not participate in any calculation
- /// and visualization: like it was removed. But it keeps the general parameters: colors,
+ /// and visualization: like it was removed. But it keeps the general parameters: colors,
/// visibility, etc.
/// \param theThis pointer to this object, needed to generate all events if it is necessary
/// \param theFlag makes disabled if it is true
}
void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
const int theTag)
{
myBuilder->generated(theOldShape, theNewShape, theName, theTag);
{
myBuilder->deleted(theOldShape, theTag);
}
-
+
void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
+ const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
const bool theIsStoreSeparate)
{
myBuilder->loadAndOrientModifiedShapes(
theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
}
-void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
+void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag)
{
myBuilder->loadFirstLevel(theShape, theName, theTag);
/// \brief Stores the shape (called by the execution method).
/// param[in] theShape shape to store.
- /// param[in] theIsStoreSameShapes if false stores reference to the same shape
+ /// param[in] theIsStoreSameShapes if false stores reference to the same shape
/// if it is already in document.
MODELAPI_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
const bool theIsStoreSameShapes = true);
MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const std::string& theName, const int theTag = 1);
- /// Records the shape newShape which was generated from the shape oldShape during a topological
- /// construction. As an example, consider the case of a face generated from an edge in
+ /// Records the shape newShape which was generated from the shape oldShape during a topological
+ /// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
const int theTag = 1);
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face removed by a Boolean operation.
MODELAPI_EXPORT virtual void deleted(
const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1);
-
+
/// load deleted shapes
MODELAPI_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
/// load and orient modified shapes
MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
+ const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
const bool theIsStoreSeparate = false);
/// load and orient generated shapes
MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
/// load shapes of the first level (to be used during shape import)
- MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
+ MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
-
+
/// load disconnected edges
MODELAPI_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
const std::string& theName, int& theTag);
/// Returns the part-document of this result
virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
- /// Returns the original part result: for transfomration features results this is
+ /// Returns the original part result: for transfomration features results this is
/// the original Part feature result
virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
virtual bool updateInPart(const int theIndex) = 0;
/// Applies the additional transformation of the part
- virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
+ virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
const std::shared_ptr<GeomAPI_Trsf>& theTransformation) = 0;
/// Returns the shape by the name in the part
}
/// instance of the events creator, one pre application
-const ModelAPI_EventCreator* MY_API_CREATOR = 0;
+const ModelAPI_EventCreator* MY_API_CREATOR = 0;
const ModelAPI_EventCreator* ModelAPI_EventCreator::get()
{
//! Starts a new operation (opens a transaction)
//! \param theId of operation for history (optional)
- //! \param theAttachedToNested if it is true,
- //! it means that this transaction is attached to the nested
+ //! \param theAttachedToNested if it is true,
+ //! it means that this transaction is attached to the nested
//! where it is located and will be committed on the next commit with the nested
virtual void startOperation(
const std::string& theId = "", const bool theAttachedToNested = false) = 0;
//! Finishes the previously started operation (closes the transaction)
virtual void finishOperation() = 0;
- //! Aborts the operation
+ //! Aborts the operation
virtual void abortOperation() = 0;
//! Returns true if operation has been started, but not yet finished or aborted
virtual bool isOperation() = 0;
virtual std::list<std::string> redoList() = 0;
/// Registers the plugin that creates features.
- /// It is obligatory for each plugin to call this function on loading to be found by
+ /// It is obligatory for each plugin to call this function on loading to be found by
/// the plugin manager on call of the feature)
virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
}
}
-const char* toString(ModelAPI_ExecState theExecState)
+const char* toString(ModelAPI_ExecState theExecState)
{
#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
switch (theExecState) {
return anError;
}
-ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup,
+ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup,
const std::string& theName)
{
for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) {
return true;
}
-bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue,
+bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue,
ResultParameterPtr& theParam, const DocumentPtr& theDocument)
{
SessionPtr aSession = ModelAPI_Session::get();
ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub)
{
- // to optimize and avoid of crash on partset document close
+ // to optimize and avoid of crash on partset document close
// (don't touch the sub-document structure)
- if (theMain != theSub) {
+ if (theMain != theSub) {
for (int a = theMain->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
theMain->object(ModelAPI_ResultPart::group(), a));
FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub)
{
- // to optimize and avoid of crash on partset document close
+ // to optimize and avoid of crash on partset document close
// (don't touch the sub-document structure)
if (theMain != theSub) {
for (int a = theMain->size(ModelAPI_Feature::group()) - 1; a >= 0; a--) {
if (aBody.get()) {
FeaturePtr aFeatureOwner = aBody->document()->feature(aBody);
if (aFeatureOwner.get()) {
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
aFeatureOwner->results().cbegin();
for(; aResIter != aFeatureOwner->results().cend(); aResIter++) {
ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aResIter);
}
}
if (isDone && theFlushRedisplay) {
- // the redisplay signal should be flushed in order to erase
+ // the redisplay signal should be flushed in order to erase
// the feature presentation in the viewer
// if should be done after removeFeature() of document
Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
#endif
if (theReferences.find(aRefFeature) == theReferences.end())
theReferences.insert(aRefFeature);
- addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences,
+ addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences,
theRecLevel, theReferences);
}
}
aLast = aSelRefFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aCFeature = *anIt;
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCFeature);
if (aComposite.get() && aComposite->isSub(aFeature))
continue; /// composite of the current feature should be skipped
}
if (theUseRecursion) {
#ifdef DEBUG_CYCLING_1550
- findReferences(aSelRefFeatures, theReferences, theUseComposite,
+ findReferences(aSelRefFeatures, theReferences, theUseComposite,
theUseRecursion, theRecLevel);
#else
findReferences(theReferences[aFeature], theReferences, theUseComposite, theUseRecursion,
std::cout << " Ref: " << getFeatureInfo(aFeature) << std::endl;
#endif
aRecLevel++;
- addRefsToFeature(aFeature, aMainList, theReferences,
+ addRefsToFeature(aFeature, aMainList, theReferences,
aRecLevel, aResultRefList/*aMainRefList*/);
}
theReferences[aMainListFeature] = aResultRefList;
std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeature);
if (aComposite.get() && aComposite->isSub(aFeature))
continue; /// composite of the current feature should not be removed
std::string aValue = "not defined";
std::string aType = theAttribute->attributeType();
if (aType == GeomDataAPI_Point2D::typeId()) {
- std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (aPoint.get() && aPoint->isInitialized()) {
- aValue = std::string("(" + doubleToString(aPoint->x()) + ", "+
+ aValue = std::string("(" + doubleToString(aPoint->x()) + ", "+
doubleToString(aPoint->y()) + ")");
}
}
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Double.cpp
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Double.h
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
-#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_ */
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_ */
CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aFeatIt);
if (aCompFeat) // iteratively process composite features
isOk = process(aCompFeat) && isOk;
- else if (!isDumped(*aFeatIt)) // dump common feature
+ else if (!isDumped(*aFeatIt)) // dump common feature
dumpFeature(*aFeatIt);
}
return isOk;
}
-bool ModelHighAPI_Dumper::process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+bool ModelHighAPI_Dumper::process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
bool isForce)
{
// increase composite features stack
for (ModulesMap::const_iterator aModIt = myModules.begin();
aModIt != myModules.end(); ++aModIt) {
aFile << "from " << aModIt->first << " import ";
- if (aModIt->second.empty() ||
+ if (aModIt->second.empty() ||
aModIt->second.find(std::string()) != aModIt->second.end())
aFile << "*"; // import whole module
else {
}
// set result deflection
if (!isDefaultDeflection(*aResIt)) {
- AttributeDoublePtr aDeflectionAttr =
+ AttributeDoublePtr aDeflectionAttr =
(*aResIt)->data()->real(ModelAPI_Result::DEFLECTION_ID());
if(aDeflectionAttr.get() && aDeflectionAttr->isInitialized()) {
*this << *aResIt;
FeaturePtr aFeature = ModelAPI_Feature::feature(theResult);
int anIndex = 0;
std::list<ResultPtr> aResults = aFeature->results();
- for(std::list<ResultPtr>::const_iterator
+ for(std::list<ResultPtr>::const_iterator
anIt = aResults.cbegin(); anIt != aResults.cend(); ++anIt, ++anIndex) {
if(theResult->isSame(*anIt)) {
break;
return *this;
}
- myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" <<
+ myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" <<
theAttrSelect->namingName() << "\")";
return *this;
}
} else {
isAdded = true;
}
- myDumpBuffer << "model.selection(\"" <<
+ myDumpBuffer << "model.selection(\"" <<
aShape->shapeTypeStr() << "\", \"" << anAttribute->namingName() << "\")";
}
/// Add module to list of imported modules
/// \param theModuleName name of the module to be imported
- /// \param theObject name of the entity to be imported
+ /// \param theObject name of the entity to be imported
/// from the module (if empty, while module will be imported)
MODELHIGHAPI_EXPORT
void importModule(const std::string& theModuleName,
/// Returns name of specified entity
/// \param theEntity [in] named entity
- /// \param theSaveNotDumped [in]
+ /// \param theSaveNotDumped [in]
/// if \c true, the entity should be stored as not dumped (will be dumped automatically)
- /// \param theUseEntityName [in]
+ /// \param theUseEntityName [in]
/// if \c true, the entity name should be used "as is" without changing default name
/// \return name of the entity
MODELHIGHAPI_EXPORT
- const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true,
+ const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true,
bool theUseEntityName = false);
/// Returns name of parent composite feature for specified entity
ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult);
/// Dump Attribute
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
/// Dump Object
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
/// Dump AttributeRefAttr
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
/// Dump AttributeRefAttrList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
/// Dump AttributeRefList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
/// Dump AttributeSelection
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
/// Dump AttributeSelectionList
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
/// Dump AttributeReference
- MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
/// Clear dump buffer
bool process(const std::shared_ptr<ModelAPI_Document>& theDoc);
/// Dump composite feature and all it sub-features
- bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
bool isForce = false);
/// Iterate all features in composite feature and dump them into intermediate buffer
/// \param theComposite [in] parent composite feature
/// \param theDumpModelDo [in] shows that command "model.do()" should be written at the end
MODELHIGHAPI_EXPORT
- bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
bool theDumpModelDo = false);
/// Check the entity is already dumped
EntityPtr myEntity; ///< last dumped entity
bool myUserName; ///< the entity hase user-defined name
/// results of this entity, which has user-defined names or specific colors
- std::list<ResultPtr> myResults;
+ std::list<ResultPtr> myResults;
- LastDumpedEntity(EntityPtr theEntity, bool theUserName,
+ LastDumpedEntity(EntityPtr theEntity, bool theUserName,
const std::list<ResultPtr>& theResults)
: myEntity(theEntity), myUserName(theUserName), myResults(theResults)
{}
protected:
/// list of entities, used by other features but not dumped yet
- std::set<EntityPtr> myNotDumpedEntities;
+ std::set<EntityPtr> myNotDumpedEntities;
friend class SketchAPI_Sketch;
};
for(; aRes != allResults.end() && aResIter != myRes.end(); aRes++, aResIter++) {
anError = compareData((*aRes)->data(), *aResIter);
if (!anError.empty())
- return "Results of feature '" + theFeature->name() + "' '" + (*aRes)->data()->name() +
+ return "Results of feature '" + theFeature->name() + "' '" + (*aRes)->data()->name() +
"' differ:" + anError;
}
if (aRes != allResults.end()) {
return ""; // ok
}
-void ModelHighAPI_FeatureStore::storeData(std::shared_ptr<ModelAPI_Data> theData,
+void ModelHighAPI_FeatureStore::storeData(std::shared_ptr<ModelAPI_Data> theData,
std::map<std::string, std::string>& theAttrs)
{
// store name to keep also this information and output if needed
- theAttrs["__name__"] = theData->name();
+ theAttrs["__name__"] = theData->name();
std::list<std::shared_ptr<ModelAPI_Attribute> > allAttrs = theData->attributes("");
std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = allAttrs.begin();
for(; anAttr != allAttrs.end(); anAttr++) {
}
}
-std::string ModelHighAPI_FeatureStore::compareData(std::shared_ptr<ModelAPI_Data> theData,
+std::string ModelHighAPI_FeatureStore::compareData(std::shared_ptr<ModelAPI_Data> theData,
std::map<std::string, std::string>& theAttrs)
{
std::map<std::string, std::string> aThis;
return "original model had no attribute '" + aThisIter->first + "'";
}
if (theAttrs[aThisIter->first] != aThisIter->second) {
- return "attribute '" + aThisIter->first + "' is different (original != current) '" +
+ return "attribute '" + aThisIter->first + "' is different (original != current) '" +
theAttrs[aThisIter->first] + "' != '" + aThisIter->second + "'";
}
}
return "";
}
-static void dumpArray(std::ostringstream& theOutput, const double theArray[],
+static void dumpArray(std::ostringstream& theOutput, const double theArray[],
int theSize, int thePrecision = PRECISION)
{
for (int i = 0; i < theSize; ++i) {
return aResult.str();
} else if (aType == ModelAPI_AttributeString::typeId()) {
// special case for attribute "SolverError"
- if (theAttr->id() == "SolverError" &&
+ if (theAttr->id() == "SolverError" &&
std::dynamic_pointer_cast<ModelAPI_Feature>(theAttr->owner())->getKind() == "Sketch")
return "";
}
aResult<<"__empty__";
}
} else if (aType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttr);
aResult<<anAttr->namingName();
} else if (aType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr anAttr =
+ AttributeSelectionListPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttr);
for(int a = 0; a < anAttr->size(); a++) {
if (a != 0)
aResult<<anAttr->value(a)->namingName();
}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr =
+ AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttr);
ObjectPtr anObj = anAttr->isObject() ? anAttr->object() : anAttr->attr()->owner();
if (anObj.get()) {
aResult<<"__empty__";
}
} else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr anAttr =
+ AttributeRefListPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttr);
// for sketch sub-features the empty values may be skipped and order is not important
- bool isSketchFeatures = anAttr->id() == "Features" &&
+ bool isSketchFeatures = anAttr->id() == "Features" &&
std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->owner())->getKind() == "Sketch";
std::list<ObjectPtr> aList = anAttr->list();
std::list<std::string> aResList; // list of resulting strings
aResult<<*aR<<" ";
}
} else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- AttributeRefAttrListPtr anAttr =
+ AttributeRefAttrListPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttr);
std::list<std::pair<ObjectPtr, AttributePtr> > aList = anAttr->list();
std::list<std::pair<ObjectPtr, AttributePtr> >::iterator aL = aList.begin();
}
}
} else if (aType == ModelAPI_AttributeIntArray::typeId()) {
- AttributeIntArrayPtr anAttr =
+ AttributeIntArrayPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeIntArray>(theAttr);
for(int a = 0; a < anAttr->size(); a++)
aResult<<anAttr->value(a)<<" ";
} else if (aType == ModelAPI_AttributeDoubleArray::typeId()) {
- AttributeDoubleArrayPtr anAttr =
+ AttributeDoubleArrayPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(theAttr);
for(int a = 0; a < anAttr->size(); a++)
aResult<<anAttr->value(a)<<" ";
private:
/// stores the information about all attributes of data in map
- void storeData(std::shared_ptr<ModelAPI_Data> theData,
+ void storeData(std::shared_ptr<ModelAPI_Data> theData,
std::map<std::string, std::string>& theAttrs);
/// compares the information about all attributes of data with map
/// returns not empty string with error if something is different
- std::string compareData(std::shared_ptr<ModelAPI_Data> theData,
+ std::string compareData(std::shared_ptr<ModelAPI_Data> theData,
std::map<std::string, std::string>& theAttrs);
/// dumps the attribute content to the string
std::string dumpAttr(const AttributePtr& theAttr);
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Integer.cpp
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Integer.h
-// Purpose:
+// Purpose:
//
// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Interface.cpp
-// Purpose:
+// Purpose:
//
// History:
// 17/05/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Interface.h
-// Purpose:
+// Purpose:
//
// History:
// 17/05/16 - Sergey POKHODENKO - Creation of the file
public:
//--------------------------------------------------------------------------------------
-// Used in INTERFACE_N inside START_INIT/END_INIT for
+// Used in INTERFACE_N inside START_INIT/END_INIT for
// set variable with attribute received from feature
#define SET_ATTRIBUTE(NAME, TYPE, ATT_NAME) \
VAR_NAME(NAME) = std::dynamic_pointer_cast<TYPE>(feature()->attribute(ATT_NAME)); \
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_RefAttr.cpp
-// Purpose:
+// Purpose:
//
// History:
// 08/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_RefAttr.h
-// Purpose:
+// Purpose:
//
// History:
// 08/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~ModelHighAPI_RefAttr();
/// Fill attribute values
- MODELHIGHAPI_EXPORT virtual
+ MODELHIGHAPI_EXPORT virtual
void fillAttribute(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const;
/// Append to list attribute
- MODELHIGHAPI_EXPORT virtual
+ MODELHIGHAPI_EXPORT virtual
void appendToList(const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const;
/// Check the object is empty
virtual ~ModelHighAPI_Reference();
/// Fill attribute values
- MODELHIGHAPI_EXPORT virtual
+ MODELHIGHAPI_EXPORT virtual
void fillAttribute(const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute) const;
/// Append to list attribute
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Selection.cpp
-// Purpose:
+// Purpose:
//
// History:
// 06/06/16 - Sergey POKHODENKO - Creation of the file
{
switch(myVariantType) {
case VT_Empty: return;
- case VT_ResultSubShapePair:
- theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second);
+ case VT_ResultSubShapePair:
+ theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second);
return;
- case VT_TypeSubShapeNamePair:
+ case VT_TypeSubShapeNamePair:
theAttribute->selectSubShape(myTypeSubShapeNamePair.first, myTypeSubShapeNamePair.second);
return;
}
{
switch(myVariantType) {
case VT_Empty: return;
- case VT_ResultSubShapePair:
- theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second);
+ case VT_ResultSubShapePair:
+ theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second);
return;
case VT_TypeSubShapeNamePair:
// Note: the reverse order (first - type, second - sub-shape name)
std::string ModelHighAPI_Selection::shapeType() const
{
switch(myVariantType) {
- case VT_ResultSubShapePair:
- return myResultSubShapePair.second.get() ? myResultSubShapePair.second->shapeTypeStr() :
+ case VT_ResultSubShapePair:
+ return myResultSubShapePair.second.get() ? myResultSubShapePair.second->shapeTypeStr() :
myResultSubShapePair.first->shape()->shapeTypeStr();
case VT_TypeSubShapeNamePair: return myTypeSubShapeNamePair.first;
}
if (myVariantType != VT_ResultSubShapePair)
return;
- AttributeDoublePtr aDeflectionAttr =
+ AttributeDoublePtr aDeflectionAttr =
myResultSubShapePair.first->data()->real(ModelAPI_Result::DEFLECTION_ID());
aDeflectionAttr->setValue(theValue);
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Selection.h
-// Purpose:
+// Purpose:
//
// History:
// 06/06/16 - Sergey POKHODENKO - Creation of the file
class ModelAPI_AttributeSelectionList;
class ModelAPI_Result;
//--------------------------------------------------------------------------------------
-typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
+typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
ResultSubShapePair;
typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
//--------------------------------------------------------------------------------------
/// Constructor for result and sub-shape
MODELHIGHAPI_EXPORT
ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
- const std::shared_ptr<GeomAPI_Shape>& theSubShape =
+ const std::shared_ptr<GeomAPI_Shape>& theSubShape =
std::shared_ptr<GeomAPI_Shape>());
/// Constructor for sub-shape by the textual Name
MODELHIGHAPI_EXPORT
virtual ~ModelHighAPI_Selection();
/// Fill attribute values
- MODELHIGHAPI_EXPORT virtual
+ MODELHIGHAPI_EXPORT virtual
void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
/// Append to list attribute
- MODELHIGHAPI_EXPORT virtual
+ MODELHIGHAPI_EXPORT virtual
void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
/// \return variant type.
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Services.cpp
-// Purpose:
+// Purpose:
//
// History:
// 17/06/16 - Sergey POKHODENKO - Creation of the file
return std::string();
// XOY or XOZ
- if (fabs(theNormal->x()) < aTol &&
+ if (fabs(theNormal->x()) < aTol &&
fabs(theDirX->x() - 1.0) < aTol && fabs(theDirX->y()) < aTol && fabs(theDirX->z()) < aTol) {
// XOY
if (fabs(theNormal->y()) < aTol && fabs(theNormal->z() - 1.0) < aTol)
return std::string("XOZ");
}
// YOZ
- else if (fabs(theNormal->x() - 1.0) < aTol &&
+ else if (fabs(theNormal->x() - 1.0) < aTol &&
fabs(theNormal->y()) < aTol && fabs(theNormal->z()) < aTol &&
- fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol &&
+ fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol &&
fabs(theDirX->z()) < aTol)
return std::string("YOZ");
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Tools.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
{
GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
- std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(),
+ std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(),
theShapeTypeStr.begin(), ::tolower);
if(theShapeTypeStr == "compound") {
for(; allIter != allFeatures.end(); allIter++) {
FeaturePtr aFeat = *allIter;
if (theCompare) {
- std::map<std::string, ModelHighAPI_FeatureStore>::iterator
+ std::map<std::string, ModelHighAPI_FeatureStore>::iterator
aFeatFind = aDocFind->second.find(aFeat->name());
if (aFeatFind == aDocFind->second.end()) {
return "Document '" + theDocName + "' feature '" + aFeat->name() + "' not found";
std::list<ResultPtr>::iterator aRes = allResults.begin();
for(; aRes != allResults.end(); aRes++) {
// recoursively store features of sub-documents
- if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
+ if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
if (aDoc.get()) {
std::string anError = storeFeatures((*aRes)->data()->name(), aDoc, theStore, theCompare);
aLostName = aLostIter->first;
}
}
- return "For document '" + theDocName +
+ return "For document '" + theDocName +
"' the number of features is decreased, there is no feature '" + aLostName + "'";
}
}
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Tools.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
-#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */
#endif
#endif
-#endif //MODULEBASE_H\r
\ No newline at end of file
+#endif //MODULEBASE_H
bool visible; //!< action's visibility state
//! = true if the acton is a modal dialog box else property panel (==false by default)
- bool modal;
+ bool modal;
QIcon icon; //!< action's icon
QString text; //!< action's text
QString iconText; //!< action's descriptive icon text
#include <QPushButton>
-ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId,
- const std::string& theDescription) :
- QDialog(theParent->desktop()),
- myId(theId),
- myDescription(theDescription),
+ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId,
+ const std::string& theDescription) :
+ QDialog(theParent->desktop()),
+ myId(theId),
+ myDescription(theDescription),
myWorkshop(theParent),
myActiveWidget(0)
{
/// \param theParent a workshop object instance
/// \param theId an Id of a feature
/// \param theDescription an XML description of the feature
- ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId,
+ ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId,
const std::string& theDescription);
/// Redefinition of virtual method
// VSR 01/07/2010: Disable thousands separator for spin box
// (to avoid inconsistency of double-2-string and string-2-double conversion)
QLocale loc;
- loc.setNumberOptions(loc.numberOptions() |
- QLocale::OmitGroupSeparator |
+ loc.setNumberOptions(loc.numberOptions() |
+ QLocale::OmitGroupSeparator |
QLocale::RejectGroupSeparator);
setLocale(loc);
- // MPV 15/09/2014: this must be set before setDecimals;
+ // MPV 15/09/2014: this must be set before setDecimals;
// otherwise in release mode setDecimals may crash
myPrecision = thePrecision;
if (overhead == 0)
state = v.validate(str, pos);
else {
- if ((uint)(str.length()) >= overhead &&
- str.startsWith(pref) &&
+ if ((uint)(str.length()) >= overhead &&
+ str.startsWith(pref) &&
str.right(suff.length()) == suff) {
QString core = str.mid(pref.length(), str.length() - overhead);
int corePos = pos - pref.length();
void ModuleBase_DoubleSpinBox::setValueEnabled(const bool& theEnable)
{
setReadOnly(!theEnable);
-
+
QPalette aPal = palette();
aPal.setColor(QPalette::All, QPalette::Base,
theEnable? myEnabledBaseColor : aPal.color(QPalette::Disabled, QPalette::Base));
bool enableKeyPressEvent(const bool& theEnable);
/// Imitation of disable control value. If theEnable is false, the control becomes
- /// read only and base color is disabled.
+ /// read only and base color is disabled.
void setValueEnabled(const bool& theEnable);
signals:
protected:
/// current instance of the OCC selection filter
- Handle(SelectMgr_Filter) myFilter;
+ Handle(SelectMgr_Filter) myFilter;
};
#endif //ModuleBase_Filter
ModuleBase_Filter* theFilter)
{
if (myIDs.find(theID) != myIDs.end()) {
- Events_InfoMessage("ModuleBase_FilterFactory",
+ Events_InfoMessage("ModuleBase_FilterFactory",
"Filter %1 is already registered").arg(theID).send();
} else {
myIDs[theID] = theFilter;
{
SelectMgr_ListOfFilter aFilters;
- std::map<std::string, std::map<std::string, AttrFilters> >::const_iterator aFeature =
+ std::map<std::string, std::map<std::string, AttrFilters> >::const_iterator aFeature =
myAttrs.find(theFeatureID);
if (aFeature != myAttrs.cend()) {
std::map<std::string, AttrFilters>::const_iterator anAttr = aFeature->second.find(theAttrID);
* \param theOwner the result of selection
* \return whether the owner is selectable in the viewer
*/
- Standard_EXPORT virtual
+ Standard_EXPORT virtual
Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_FilterValidated)
void ModuleBase_IErrorMgr::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
{
- myPropertyPanel = theProp;
+ myPropertyPanel = theProp;
if (myPropertyPanel) {
foreach(const ModuleBase_ModelWidget* aWgt, myPropertyPanel->modelWidgets()) {
#include <QPushButton>
ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent)
- : QObject(theParent), myWorkshop(theParent)
+ : QObject(theParent), myWorkshop(theParent)
{
connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
void ModuleBase_IModule::launchOperation(const QString& theCmdId)
{
/// selection should be obtained from workshop before ask if the operation can be started as
- /// the canStartOperation method performs commit/abort of previous operation.
+ /// the canStartOperation method performs commit/abort of previous operation.
/// Sometimes commit/abort may cause selection clear(Sketch operation) as a result
/// it will be lost and is not used for preselection.
ModuleBase_ISelection* aSelection = myWorkshop->selection();
- QList<ModuleBase_ViewerPrsPtr> aPreSelected =
+ QList<ModuleBase_ViewerPrsPtr> aPreSelected =
aSelection->getSelected(ModuleBase_ISelection::AllControls);
if (!myWorkshop->canStartOperation(theCmdId))
return !aFOperation || !aFOperation->hasObject(theObject);
}
-void ModuleBase_IModule::operationResumed(ModuleBase_Operation* theOperation)
+void ModuleBase_IModule::operationResumed(ModuleBase_Operation* theOperation)
{
emit resumed(theOperation);
}
/// Restores the current selection
virtual void restoreSelection() {};
- /// Reads description of features from XML file
+ /// Reads description of features from XML file
virtual void createFeatures();
/// Called on creation of menu item in desktop
virtual void actionCreated(QAction*);
- /// Launching of a edit operation on the feature
+ /// Launching of a edit operation on the feature
/// \param theFeature feature for editing
virtual void editFeature(FeaturePtr theFeature);
/// Creates custom widgets for property panel
/// \param theType a type of widget
/// \param theParent the parent object
- /// \param theWidgetApi the widget configuration.
+ /// \param theWidgetApi the widget configuration.
/// The attribute of the model widget is obtained from
- virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
+ virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
QWidget* theParent,
Config_WidgetAPI* theWidgetApi)
{
/// It is called as on clearing of property panel as on filling with new widgets
virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {}
- /// Have an opportunity to create widgets for the current operation
+ /// Have an opportunity to create widgets for the current operation
/// instead of standard creation in workshop
/// \param theOperation a started operation
/// \param theWidgets a list of created widgets
/// Return true if the custom presentation is activated
/// \param theFlag a flag of level of customization, which means that only part of sub-elements
/// \return boolean value
- virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const
+ virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const
{ return false; };
/// Activate custom presentation for the object. Default realization is empty.
const bool theUpdateViewer) {}
/// Modifies the given presentation in the custom way.
- virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
+ virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
AISObjectPtr thePrs,
GeomCustomPrsPtr theCustomPrs) { return false; };
* \param theName - name of the resource
* Returns Id of the ctreated item
*/
- virtual int addPreference(const QString& theLbl, int pId,
+ virtual int addPreference(const QString& theLbl, int pId,
SUIT_PreferenceMgr::PrefItemType theType,
const QString& theSection, const QString& theName ) = 0;
/// Sets widget processed by preselection
virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
- /// Returns the first widget, where canAcceptFocus returns true
+ /// Returns the first widget, where canAcceptFocus returns true
/// \return a widget or null
ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
- /// Returns the first widget, where canAcceptFocus returns true
+ /// Returns the first widget, where canAcceptFocus returns true
/// \return a widget or null
static ModuleBase_ModelWidget* findFirstAcceptingValueWidget(
const QList<ModuleBase_ModelWidget*>& theWidgets);
/// Returns a list of viewer selected presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
getSelected(const SelectionPlace& thePlace = Browser) const = 0;
- /// The values are appended to the first parameter list if the first list does not contain
+ /// The values are appended to the first parameter list if the first list does not contain
/// an item with the same object
/// \param theValues a list of new values
/// \param theValuesTo a list, that will be changed
//! Return the IO from the viewer presentation.
//! \param thePrs a selected object
//! \return an interactive object
- virtual MODULEBASE_EXPORT
+ virtual MODULEBASE_EXPORT
Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
//! Wraps the object list into the viewer prs list
ModuleBase_IViewWindow();
/// Virtual destructor
virtual ~ModuleBase_IViewWindow();
-
+
/// Returns OCCT object which contains 3d view object
virtual Handle(V3d_View) v3dView() const = 0;
/// Remember a scale factor for the view object
/// \param theView a view object
/// \param theVal a scale factor
- void SetScale(const Handle(V3d_View)& theView, const double theVal)
+ void SetScale(const Handle(V3d_View)& theView, const double theVal)
{ myWindowScale[theView] = theVal; }
- /// Method returns True if the viewer can process editing objects
+ /// Method returns True if the viewer can process editing objects
/// by mouse drugging. If this is impossible thet it has to return False.
virtual bool canDragByMouse() const { return true; }
//! Returns the factory of selection filters : the only one instance per application
ModuleBase_FilterFactory* selectionFilters() const;
-
+
//! Returns currently active operation
virtual ModuleBase_Operation* currentOperation() const = 0;
//! \param theAIS a presentation
virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
- //! Select features clearing previous selection.
+ //! Select features clearing previous selection.
//! If the list is empty then selection will be cleared
//! \param theValues a list of presentations
virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
enum EnableState { On, /// the widget value is always enabled
Off, /// the widget value is always disabled
/// the widget value enable state is defined in preferences
- DefinedInPreferences };
+ DefinedInPreferences };
/// Constructor
/// \param theParent the parent object
/// \return the boolean result
bool isInternal() const { return myIsInternal; }
- /// Returns true, if the obligatory value of the widget is
+ /// Returns true, if the obligatory value of the widget is
/// not defined in the XML or has true value
/// \return the boolean result
bool isObligatory() const { return myIsObligatory; }
- /// Returns true, if the widget value is enabled and might be modified manualy.
- /// It returns false if the application preferences allow having disabled value
+ /// Returns true, if the widget value is enabled and might be modified manualy.
+ /// It returns false if the application preferences allow having disabled value
/// and the internal state tells to disable
/// \return the boolean result
virtual bool isValueEnabled() const;
/// \param theValues a list of presentations
virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) {};
- /// Checks if the selection presentation is valid in widget
+ /// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
/// Returns widget validator, by default it is NULL. To be created in a child if necessary
ModuleBase_WidgetValidator* widgetValidator() { return myWidgetValidator; }
- /// Restore value from attribute data to the widget's control.
+ /// Restore value from attribute data to the widget's control.
/// Emits signals before and after store
/// \return True in success
bool restoreValue();
/// \return True in success
bool storeValue();
- /// Set focus to the first control of the current widget.
+ /// Set focus to the first control of the current widget.
/// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
FeaturePtr myFeature;
/// Flag which shows that current operation is in editing mode
- bool myIsEditing;
+ bool myIsEditing;
/// Flag which shows whether current widget is obligatory
/// The non-obligatory widgets should not accept the focus in the property panel
/// Value should be computed on execute, like radius for circle's constraint (can not be zero)
bool myIsComputedDefault;
- /// the default value, which is defined in the XML for this attribute
+ /// the default value, which is defined in the XML for this attribute
std::string myDefaultValue;
/// an XML internal state
}
}
-void ModuleBase_Operation::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
-{
- myPropertyPanel = theProp;
+void ModuleBase_Operation::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
+{
+ myPropertyPanel = theProp;
}
bool ModuleBase_Operation::isGranted(QString theId) const
void setGrantedOperationIds(const QStringList& theList);
/// Must return true if this operation can be launched as nested for any current operation
- /// and it is not necessary to check this operation on validity. By default
+ /// and it is not necessary to check this operation on validity. By default
/// the operation is not granted.
/// The method has to be redefined for granted operations.
virtual bool isGranted(QString theId) const;
bool ModuleBase_OperationAction::commit()
{
- // the action is supposed to perform a single modification,
+ // the action is supposed to perform a single modification,
// so the operation returns modified state
setIsModified(true);
private:
//!< Next fields could be extracted into a subclass;
/// the operation identifier
- QString myOperationId;
+ QString myOperationId;
/// the short description of the opertaion
- QString myDescription;
+ QString myDescription;
/// the xml definition
- QString myXmlRepresentation;
+ QString myXmlRepresentation;
};
#endif //ModuleBase_OperationDescription_H
}
#ifdef DEBUG_DO_NOT_ACTIVATE_SUB_FEATURE
if (aFeature->isMacro()) {
- // macro feature may refers to sub-features,
+ // macro feature may refers to sub-features,
// which also should be deactivated when the operation
// is active, e.g. rectangle'lines.
FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObj);
std::list<AttributePtr> anAttributes = aFeature->data()->attributes(
ModelAPI_AttributeRefList::typeId());
- std::list<AttributePtr>::const_iterator
+ std::list<AttributePtr>::const_iterator
anIt = anAttributes.begin(), aLast = anAttributes.end();
bool aFoundObject = false;
for (; anIt != aLast && !aFoundObject; anIt++) {
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
aCurrentFeatureResults.append(*aIt);
}
-
+
if (aCurrentFeatureResults.empty()) /// filtering of selection is not necessary
setPreselection(thePreSelected);
else { // create preselection list without results of current feature
myPreSelection.clear();
}
-void ModuleBase_OperationFeature::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
+void ModuleBase_OperationFeature::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
{
ModuleBase_Operation::setPropertyPanel(theProp);
}
// Do not activate widgets by default if the current operation is editing operation
- // Because we don't know which widget is going to be edited.
+ // Because we don't know which widget is going to be edited.
if (!isEditOperation()) {
// 4. activate the first obligatory widget
theProp->activateNextWidget(NULL);
virtual ModuleBase_ModelWidget* activateByPreselection(const std::string& theGreedAttributeId);
/// If the operation works with feature which is sub-feature of another one
- /// then this variable has to be initialised by parent feature
+ /// then this variable has to be initialised by parent feature
/// before operation feature creating
void setParentFeature(CompositeFeaturePtr theParent);
/// Editing feature flag
bool myIsEditing;
- /// List of pre-selected object
+ /// List of pre-selected object
QList<std::shared_ptr<ModuleBase_ViewerPrs>> myPreSelection;
/// If the operation works with feature which is sub-feature of another one
- /// then this variable has to be initialised by parent feature
+ /// then this variable has to be initialised by parent feature
/// before operation feature creating
CompositeFeaturePtr myParentFeature;
// Issue #460: this patch is necessary since the row stretch information
// is stored independently on the items: when the items are removed
- // from the layout the stretch information is kept, so in the next
+ // from the layout the stretch information is kept, so in the next
// filling of the layout some "additional" (old) rows may be stretched
- // without necessity.
+ // without necessity.
// In this patch we clear the stretch information specifying the default value: 0.
QGridLayout* aLayout = dynamic_cast<QGridLayout*>( pageLayout() );
if( aLayout )
#include <QVBoxLayout>
-ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent,
+ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent,
const Config_WidgetAPI* theData)
: ModuleBase_ModelWidget(theParent, theData),
myIsFocusOnCurrentPage(false)
/// \param theMgr a preferences manager
ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {}
- virtual int addPreference(const QString& theLbl, int pId,
+ virtual int addPreference(const QString& theLbl, int pId,
SUIT_PreferenceMgr::PrefItemType theType,
const QString& theSection, const QString& theName )
{
//**********************************************************
//**********************************************************
//**********************************************************
-ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces,
+ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces,
QWidget* theParent)
: QDialog(theParent),
myIsChanged(false)
// Create other parameters group in viewer tab
int selectionGroup = myPreferences->addItem(tr("Default selection"), viewTab);
myPreferences->setItemProperty("columns", 3, selectionGroup);
- myPreferences->addItem(tr("Faces"), selectionGroup,
+ myPreferences->addItem(tr("Faces"), selectionGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
- myPreferences->addItem(tr("Edges"), selectionGroup,
+ myPreferences->addItem(tr("Edges"), selectionGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
- myPreferences->addItem(tr("Vertices"), selectionGroup,
+ myPreferences->addItem(tr("Vertices"), selectionGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
myPreferences->setItemProperty("columns", 1, aSizeGroup);
int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup,
- SUIT_PreferenceMgr::IntSpin,
+ SUIT_PreferenceMgr::IntSpin,
ModuleBase_Preferences::MENU_SECTION,
"rows_number");
myPreferences->setItemProperty("min", 1, aRowsNb);
/// Create a viewer page in dialog box
void createViewerPage(int thePageId);
-
+
/// Create menu properties page in the dialog box
void createMenuPage(int thePageId);
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
Set(aShape);
Handle(Prs3d_Drawer) aDrawer = Attributes();
- if (aDrawer->HasOwnPointAspect())
+ if (aDrawer->HasOwnPointAspect())
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
void ModuleBase_ResultPrs::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
if (!aReadyToDisplay) {
- Events_InfoMessage("ModuleBase_ResultPrs",
+ Events_InfoMessage("ModuleBase_ResultPrs",
"An empty AIS presentation: ModuleBase_ResultPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_COMPSOLID);
/// It is important to have priority for the shape of comp solid result less than priority
- /// for the presentation shape which is a sub-result.
+ /// for the presentation shape which is a sub-result.
/// Reason is to select the sub-objects before: #1592
aPriority = aPriority - 1;
double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
Handle(ModuleBase_BRepOwner) aOwner = new ModuleBase_BRepOwner(aShape, aPriority);
- StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
+ StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
aDeflection, myDrawer->HLRAngle(), 9, 500);
for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
}
}
//AIS_Shape::ComputeSelection(aSelection, 0);
- }
+ }
AIS_Shape::ComputeSelection(aSelection, aMode);
if (myAdditionalSelectionPriority > 0) {
for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
- Handle(SelectBasics_EntityOwner) aBasicsOwner =
+ Handle(SelectBasics_EntityOwner) aBasicsOwner =
aSelection->Sensitive()->BaseSensitive()->OwnerId();
if (!aBasicsOwner.IsNull())
aBasicsOwner->Set(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
}
}
-void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
+void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners)
{
Handle(SelectMgr_EntityOwner) anOwner;
}
}
}
-
-void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Quantity_NameOfColor theColor,
+
+void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Quantity_NameOfColor theColor,
const Handle(SelectMgr_EntityOwner)& theOwner)
{
Handle(StdSelect_BRepOwner) aOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
/// \param aShape an owner shape
/// \param aPriority drawig priority
/// \param ComesFromDecomposition decomposition flag
- ModuleBase_BRepOwner(const TopoDS_Shape& aShape,
- const Standard_Integer aPriority = 0,
+ ModuleBase_BRepOwner(const TopoDS_Shape& aShape,
+ const Standard_Integer aPriority = 0,
const Standard_Boolean ComesFromDecomposition = Standard_False)
: StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
/// \param aPM a presentations manager
/// \param aCol a color
/// \param aMode a drawing mode
- virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
+ virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
const Quantity_NameOfColor aCol, const Standard_Integer aMode = 0)
{ Selectable()->HilightOwnerWithColor(aPM, aCol, this); }
//! Method which draws selected owners ( for fast presentation draw )
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners);
-
+
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw )
Standard_EXPORT virtual void HilightOwnerWithColor(
/// Returns selection priorities that will be added to created selection owner
/// \return integer value
- Standard_EXPORT int getAdditionalSelectionPriority() const
+ Standard_EXPORT int getAdditionalSelectionPriority() const
{ return myAdditionalSelectionPriority; }
/// Appends a special priority for the mode of selection
/// Original shape of the result object
TopoDS_Shape myOriginalShape;
- /// selection priority that will be added to the standard
+ /// selection priority that will be added to the standard
/// selection priority of the selection entity
int myAdditionalSelectionPriority;
};
/// Returns True if selection is valid
/// \param theSelection selection instance
/// \param theOperation - current operation (can be 0)
- virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ virtual bool isValid(const ModuleBase_ISelection* theSelection,
ModuleBase_Operation* theOperation) const;
};
void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText)
{
- if (theSpin->text() == theText)
+ if (theSpin->text() == theText)
return;
// In order to avoid extra text setting because it will
// reset cursor position in control
aPtrStr << "[" << anOwner.Access() << "]";
anInfo += aPtrStr.str().c_str();
- Handle(AIS_InteractiveObject) aAISObj =
+ Handle(AIS_InteractiveObject) aAISObj =
Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
if (!aAISObj.IsNull()) {
std::ostringstream aPtrStr;
return aValue;
}
-QString selectedOwners(Handle(AIS_InteractiveContext)& theContext,
+QString selectedOwners(Handle(AIS_InteractiveContext)& theContext,
const bool theShapeInfoOnly = true)
{
QStringList anObjects;
hasResult |= (aResult.get() != NULL);
hasFeature |= (aFeature.get() != NULL);
hasParameter |= (aConstruction.get() != NULL);
- if (hasFeature)
+ if (hasFeature)
hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
if (hasFeature && hasResult && hasParameter && hasCompositeOwner)
break;
anObject = anAttr->context();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr =
+ AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
if (anAttr.get() != NULL)
anObject = anAttr->value();
}
}
-std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop,
+std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop,
const FeaturePtr& theFeature)
{
std::string anAttributeId;
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr aRef =
+ AttributeReferencePtr aRef =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr aObject = aRef->value();
aHasObject = aObject && aObject->isSame(theObject);
// aRef->setValue(theObject);
//}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
aHasObject = aSelectionListAttr->isInList(aResult, theShape, theTemporarily);
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr =
+ AttributeRefListPtr aRefListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
aHasObject = aRefListAttr->isInList(theObject);
//if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject))
// aRefListAttr->append(theObject);
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- AttributeRefAttrListPtr aRefAttrListAttr =
+ AttributeRefAttrListPtr aRefAttrListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
bool isDone = true;
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr aRef =
+ AttributeReferencePtr aRef =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr aObject = aRef->value();
if (!(aObject && aObject->isSame(theObject))) {
aRef->setValue(theObject);
}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- if (!theCheckIfAttributeHasObject ||
+ if (!theCheckIfAttributeHasObject ||
!aSelectionListAttr->isInList(aResult, theShape, theTemporarily))
aSelectionListAttr->append(aResult, theShape, theTemporarily);
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr =
+ AttributeRefListPtr aRefListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) {
if (theObject.get())
}
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- AttributeRefAttrListPtr aRefAttrListAttr =
+ AttributeRefAttrListPtr aRefAttrListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr.get() && !aRefAttr->isObject()) {
AttributePtr anAttribute = aRefAttr->attr();
}
//**************************************************************
-void refsToFeatureInFeatureDocument(const ObjectPtr& theObject,
+void refsToFeatureInFeatureDocument(const ObjectPtr& theObject,
std::set<FeaturePtr>& theRefFeatures)
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
std::string aNotActivatedNames;
if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures))
- aNotActivatedDocWrn =
+ aNotActivatedDocWrn =
QObject::tr("Selected objects can be used in Part documents which are not loaded:%1.\n")
.arg(aNotActivatedNames.c_str());
}
-
+
std::set<FeaturePtr> aFeaturesRefsTo;
std::set<FeaturePtr> aFeaturesRefsToParameter;
std::set<FeaturePtr> aParameterFeatures;
"be deleted.\nOr parameters could be replaced by their values.\n";
aText += QString(QObject::tr(aMsg))
.arg(aParamFeatureNames.join(aSep));
- QPushButton *aReplaceButton =
+ QPushButton *aReplaceButton =
aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole);
}
ModelAPI_ReplaceParameterMessage::send(aObj, 0);
}
else
- theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(),
+ theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(),
aFeaturesRefsToParameterOnly.end());
}
return true;
aPixMap = new Image_AlienPixMap();
if(!aPixMap->Load(aFile.c_str())) {
// The icon for constraint is not found
- static const std::string aMsg =
+ static const std::string aMsg =
"Error: Point market not found by path: \"" + aFile + "\". Falling back.";
//Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", aMsg).send();
}
/// \ingroup GUI
/// Methods to modify a resource pixmap
-/// Create composite pixmap.
+/// Create composite pixmap.
/// Pixmap \a theAdditionalIcon is drawn over pixmap \a dest with coordinates
/// specified relatively to the upper left corner of \a theIcon.
/// \return resulting pixmap
MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon);
-/// Generates the pixmap lighter than the resources pixmap.
+/// Generates the pixmap lighter than the resources pixmap.
/// Pixmap \a theIcon is lighted according to the given value.
/// If the lighter value is greater than 100, this functions returns a lighter pixmap.
-/// Setting lighter value to 150 returns a color that is 50% brighter.
+/// Setting lighter value to 150 returns a color that is 50% brighter.
/// If the factor is less than 100,
/// the return pixmap is darker. If the factor is 0 or negative, the return pixmap is unspecified.
/// \param theObj an object
/// \param isUseAttributesInfo a flag whether the attribute values information is used
/// \return a string
-MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj,
+MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj,
const bool isUseAttributesInfo = false);
/// Converts the AIS context information in a string information.
/// Sets the default coeffient into the driver calculated accordingly the shape type.
/// It provides 1.e-4 for a shape withe Edge shape type
-/// \param theShape a shape to define the deviation coeffient,
+/// \param theShape a shape to define the deviation coeffient,
/// \param theDrawer a drawer
MODULEBASE_EXPORT void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
/// \param theReferencesToDelete an out set for references features to be removed
/// \return true if in message box answer is Yes
bool MODULEBASE_EXPORT askToDelete(const std::set<FeaturePtr> aFeatures,
- const std::map<FeaturePtr,
+ const std::map<FeaturePtr,
std::set<FeaturePtr> >& theReferences,
QWidget* theParent,
std::set<FeaturePtr>& theReferencesToDelete,
/// of this parameter is to be removed
/// \param theObjects a list of objects
/// \param theFeatures an out conteiner of features
-void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects,
+void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects,
std::set<FeaturePtr>& theFeatures);
/// Returns translation from the given data.
-/// If translation is not exists then it returns a string
+/// If translation is not exists then it returns a string
/// from the info data without translation
/// \param theContext context of the message (Feature Id)
/// \param theMessage a message which dave to be translated
public:
/// Constructor
/// \param theWorkshop instance of workshop interface
- Standard_EXPORT
+ Standard_EXPORT
ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
myWorkshop(theWorkshop) {}
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual
+ Standard_EXPORT virtual
Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter)
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual
+ Standard_EXPORT virtual
Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter)
#include <ModuleBase_ResultPrs.h>
-ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult,
- const GeomShapePtr& theShape,
- Handle_SelectMgr_EntityOwner theOwner)
+ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult,
+ const GeomShapePtr& theShape,
+ Handle_SelectMgr_EntityOwner theOwner)
: myResult(theResult),
myShape(theShape),
myOwner(theOwner)
// and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal
// as they use the same shape and result(of compsolid)
Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner);
- Handle(StdSelect_BRepOwner) aCSolidOwner2 =
+ Handle(StdSelect_BRepOwner) aCSolidOwner2 =
Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner());
isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull();
if (!aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull())
// and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal
// as they use the same shape and result(of compsolid)
Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner);
- Handle(StdSelect_BRepOwner) aCSolidOwner2 =
+ Handle(StdSelect_BRepOwner) aCSolidOwner2 =
Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner());
isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull();
if (!aCSolidOwner1.IsNull() && !aCSolidOwner1.IsNull())
#include <QToolButton>
-ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
+ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
const Config_WidgetAPI* theData)
: ModuleBase_ModelWidget(theParent, theData), myCombo(0), myButtons(0)
{
std::string aWgtDir = theData->getProperty("buttons_dir");
if (aWgtDir == "horizontal")
aBtnLayout = new QHBoxLayout(aGroupBox);
- else
+ else
aBtnLayout = new QVBoxLayout(aGroupBox);
ModuleBase_Tools::adjustMargins(aBtnLayout);
QPixmap aIcon = ModuleBase_IconFactory::loadPixmap(aIconList.at(aId));
aBtn->setIcon(aIcon);
aBtn->setIconSize(aIcon.size());
-
+
aBtnLayout->addWidget(aBtn);
myButtons->addButton(aBtn, aId++);
}
myCombo = new QComboBox(this);
aLayout->addWidget(myCombo, 1);
-
+
myCombo->addItems(aList);
connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice()
{
}
-
+
bool ModuleBase_WidgetChoice::storeValueCustom()
{
DataPtr aData = myFeature->data();
}
}
}
-
+
DataPtr aData = myFeature->data();
AttributeRefListPtr anAttributeList = aData->reflist(attributeID());
int aSize = anAttributeList->size();
std::shared_ptr<ModuleBase_WidgetCreatorFactory> ModuleBase_WidgetCreatorFactory::get()
{
if (!MY_WIDGET_CREATOR_FACTORY) {
- MY_WIDGET_CREATOR_FACTORY =
+ MY_WIDGET_CREATOR_FACTORY =
std::shared_ptr<ModuleBase_WidgetCreatorFactory>(new ModuleBase_WidgetCreatorFactory());
}
return MY_WIDGET_CREATOR_FACTORY;
if (!myPanelToCreator.contains(aKey))
myPanelToCreator[aKey] = theCreator;
else {
- Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
+ Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
"The %1 panel XML definition has been already used by another widget creator")
.arg(aKey).send();
}
/// Destructor
virtual ~ModuleBase_WidgetCreatorFactory();
- /// The creator is added to the internal container
+ /// The creator is added to the internal container
/// to be used when the createWidgetByType is called
/// \param theCreator a new widget creator
void registerCreator(const WidgetCreatorPtr& theCreator);
/// Create page by its type
/// \param theType a type
/// \param theParent a parent widget
- /// \param theWidgetApi the widget configuration.
+ /// \param theWidgetApi the widget configuration.
/// The attribute of the model widget is obtained from XML
/// \return a created page or null
ModuleBase_PageBase* createPageByType(const std::string& theType,
/// Create widget by its type
/// \param theType a type
/// \param theParent a parent widget
- /// \param theWidgetApi the widget configuration.
+ /// \param theWidgetApi the widget configuration.
/// The attribute of the model widget is obtained from XML
/// \param theWorkshop a workshop object instance
/// \return a created widget or null
#include <cfloat>
#ifndef DBL_MAX
-#define DBL_MAX 1.7976931348623158e+308
+#define DBL_MAX 1.7976931348623158e+308
#endif
#ifdef _DEBUG
#include <iostream>
/// Destructor
virtual ~ModuleBase_WidgetEditor();
- /// Set focus to the first control of the current widget.
+ /// Set focus to the first control of the current widget.
/// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
private:
///< the current widget feature
- FeaturePtr myFeature;
+ FeaturePtr myFeature;
///< the kinds of possible features
- QStringList myFeatureKinds;
+ QStringList myFeatureKinds;
int myXPosition, myYPosition;
};
QPen anOldpen = aPainter.pen();
aPainter.setPen( aColor );
lineRect.adjust(minLB, 0, 0, 0);
- QString elidedText =
+ QString elidedText =
aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() );
aPainter.drawText( lineRect, va, elidedText );
aPainter.setPen( anOldpen );
bool ModuleBase_WidgetExprEditor::storeValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();
bool ModuleBase_WidgetExprEditor::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();
ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
createWidget(aPage);
if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
- ModuleBase_PagedContainer* aContainer =
+ ModuleBase_PagedContainer* aContainer =
qobject_cast<ModuleBase_PagedContainer*>(aWidget);
QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) );
if (aFound) {
theTitle = QString::fromStdString(myWidgetApi->widgetLabel()).toStdString().c_str();
if (theTitle.empty())
- theTitle =
+ theTitle =
QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)).toStdString().c_str();
}
}
{
connect(myWorkshop, SIGNAL(selectionChanged()), this,
SLOT(onSelectionChanged()), Qt::UniqueConnection);
-
+
activateFilters(true);
QIntList aShapeTypes;
//********************************************************************
bool ModuleBase_WidgetFeatureSelector::storeValueCustom()
{
- // the value is stored on the selection changed signal processing
+ // the value is stored on the selection changed signal processing
return true;
}
//********************************************************************
void ModuleBase_WidgetFeatureSelector::updateOnSelectionChanged(const bool theDone)
{
- // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in
+ // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in
// the same place repeatedly without mouse moved. In the case validation by filters is not
// perfromed, so an invalid object is selected. E.g. distance constraint, selection of a point.
// the 3rd click in the same point allow using this point.
bool ModuleBase_WidgetFileSelector::storeValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
DataPtr aData = myFeature->data();
bool ModuleBase_WidgetFileSelector::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
DataPtr aData = myFeature->data();
#include <math.h>
#ifndef INT_MAX
-#define INT_MAX 2147483647
+#define INT_MAX 2147483647
#endif
#ifdef _DEBUG
return true;
}
-bool ModuleBase_WidgetLabel::focusTo()
-{
+bool ModuleBase_WidgetLabel::focusTo()
+{
restoreValue();
- return false;
+ return false;
}
bool ModuleBase_WidgetLineEdit::storeValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();
bool ModuleBase_WidgetLineEdit::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();
QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
: tr("Selected objects:"), this);
aMainLay->addWidget(aListLabel, 1, 0);
- // if the xml definition contains one type, an information label
+ // if the xml definition contains one type, an information label
// should be shown near to the latest
if (aShapeTypes.size() <= 1) {
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
//********************************************************************
bool ModuleBase_WidgetMultiSelector::storeValueCustom()
{
- // the value is stored on the selection changed signal processing
- // A rare case when plugin was not loaded.
+ // the value is stored on the selection changed signal processing
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
//********************************************************************
bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if (!myFeature)
return false;
void ModuleBase_WidgetMultiSelector::updateFocus()
{
- // Set focus to List control in order to make possible
+ // Set focus to List control in order to make possible
// to use Tab key for transfer the focus to next widgets
myListControl->setCurrentRow(myListControl->model()->rowCount() - 1);
ModuleBase_Tools::setFocus(myListControl,
void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const int theShapeType)
{
QString aShapeTypeName;
-
+
for (int idx = 0; idx < myTypeCombo->count(); ++idx) {
aShapeTypeName = myTypeCombo->itemText(idx);
int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
QList<QListWidgetItem*> aItems = myListControl->selectedItems();
myCopyAction->setEnabled(!aItems.isEmpty());
myDeleteAction->setEnabled(!aItems.isEmpty());
-
+
myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeHighlightedObjects,
true);
}
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
std::set<AttributePtr> anAttributes;
- QList<ModuleBase_ViewerPrsPtr>::const_iterator
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator
anIt = theValues.begin(), aLast = theValues.end();
ObjectPtr anObject;
GeomShapePtr aShape;
std::string validatorType(const QString& theType) const;
protected:
- /// Returns attribute indices selected in the widget selection list
+ /// Returns attribute indices selected in the widget selection list
/// \param theIndices a list of indices
void getSelectedAttributeIndices(std::set<int>& theIndices);
//********************************************************************
void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone)
{
- // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in
+ // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in
// the same place repeatedly without mouse moved. In the case validation by filters is not
// perfromed, so an invalid object is selected. E.g. distance constraint, selection of a point.
// the 3rd click in the same point allow using this point.
{
QIntList aShapeTypes = shapeTypes();
// this type should be mentioned in XML, poor selection otherwise
- if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/
+ if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/
aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result/*TopAbs_SHAPE*/)) {
// it should be selectable for both, "solids" and "objects" types
aShapeTypes.append(TopAbs_COMPSOLID);
{
connect(myWorkshop, SIGNAL(selectionChanged()), this,
SLOT(onSelectionChanged()), Qt::UniqueConnection);
-
+
activateSelectionAndFilters(true);
// Restore selection in the viewer by the attribute selection list
getGeomSelection(thePrs, anObject, aShape);
// the last flag is to be depending on hasObject is called before. To be corrected later
- return ModuleBase_Tools::setObject(attribute(), anObject, aShape,
+ return ModuleBase_Tools::setObject(attribute(), anObject, aShape,
myWorkshop, myIsInValidate, true);
}
{
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aSelectionListAttr =
+ AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
aSelectionListAttr->setSelectionType(mySelectionType);
// restore selection in the attribute. Indeed there is only one stored object
aSelectionListAttr->removeLast();
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr =
+ AttributeRefListPtr aRefListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
// restore objects in the attribute. Indeed there is only one stored object
int aCountAppened = aRefListAttr->size() - mySelectionCount;
}
else {
ModuleBase_Tools::setObject(theAttribute, myObject, myShape, theWorkshop, true, true);
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr) {
if (!myIsObject)
private:
/// backup parameters of the model attribute. The class processes three types of attribute:
- /// Reference, RefAttr and Selection.
+ /// Reference, RefAttr and Selection.
/// Depending on the attribute type, only the attribute parameter
/// values are reserved in the backup
/// An attribute object
//********************************************************************
bool ModuleBase_WidgetShapeSelector::storeValueCustom()
{
- // the value is stored on the selection changed signal processing
+ // the value is stored on the selection changed signal processing
return true;
}
#include <QStackedLayout>
#include <QVBoxLayout>
-ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent,
+ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent,
const Config_WidgetAPI* theData)
: ModuleBase_PagedContainer(theParent, theData)
{
#include <QVBoxLayout>
#include <QIcon>
-ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent,
+ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent,
const Config_WidgetAPI* theData)
: ModuleBase_PagedContainer(theParent, theData)
{
}
//********************************************************************
-void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
+void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
const bool theValid)
{
GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr();
}
//********************************************************************
-bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
+bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
bool& theValid)
{
if (!theValue.get())
for (; anIt != aLast; anIt++) {
const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt;
ObjectPtr anObject = aViewerPrs->object();
- ResultCompSolidPtr aResultCompSolid =
+ ResultCompSolidPtr aResultCompSolid =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
if(aResultCompSolid.get()) {
aCompSolids.insert(aResultCompSolid);
bool isValidAttribute(const AttributePtr& theAttribute) const;
protected:
- /// Gets the validity state of the presentation in an internal map.
+ /// Gets the validity state of the presentation in an internal map.
/// Returns true if the valid state of value is stored
/// \param theValue a viewer presentation
/// \param theValid a valid state
ObjectPtr myPresentedObject; /// back up of the filtered object
#ifdef LIST_OF_VALID_PRS
/// cash of valid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
/// cash of invalid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
#else
// assume that one presentation selection presentation corresponds only one shape
NCollection_DataMap<TopoDS_Shape, std::shared_ptr<ModuleBase_ViewerPrs> > myValidPrs;
myInvalidPrs.clear();
}
-bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
+bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
bool& theValid)
{
bool aValidPrs = myValidPrs.contains(theValue);
}
//********************************************************************
-void ModuleBase_WidgetValidator::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
+void ModuleBase_WidgetValidator::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
const bool theValid)
{
bool aValidPrs = myInvalidPrs.contains(theValue);
//! Clear all validated cash in the widget
void clearValidatedCash();
- /// Gets the validity state of the presentation in an internal map.
+ /// Gets the validity state of the presentation in an internal map.
/// Returns true if the valid state of value is stored
/// \param theValue a viewer presentation
/// \param theValid a valid state
ModuleBase_IWorkshop* myWorkshop; ///< the active workshop
/// cash of valid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
-
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
+
/// cash of invalid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
};
#endif /* ModuleBase_WidgetValidator_H_ */
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
// Name : ParametersAPI_Parameter.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
// Name : ParametersAPI_Parameter.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~ParametersAPI_Parameter();
INTERFACE_3(ParametersPlugin_Parameter::ID(),
- name, ParametersPlugin_Parameter::VARIABLE_ID(),
+ name, ParametersPlugin_Parameter::VARIABLE_ID(),
ModelAPI_AttributeString, /** Name */,
expression, ParametersPlugin_Parameter::EXPRESSION_ID(),
ModelAPI_AttributeString, /** Expression */,
} else if (theMessage->eventID() == kReplaceParameterEvent) {
processReplaceParameterEvent(theMessage);
} else {
- Events_InfoMessage("ParametersPlugin_EvalListener",
+ Events_InfoMessage("ParametersPlugin_EvalListener",
"ParametersPlugin python interpreter, unhandled message caught: ")
.arg(theMessage->eventID().eventText()).send();
}
// If variable does not exist python interpreter will generate an error. It is OK.
// But due to the issue 1479 it should not check the history position of parameters relatively
// to feature that contains expression
- if (!ModelAPI_Tools::findVariable(/*theParameter*/ FeaturePtr(),
+ if (!ModelAPI_Tools::findVariable(/*theParameter*/ FeaturePtr(),
*it, aValue, aParamRes, theParameter->document()))
continue;
std::shared_ptr<ModelAPI_AttributeEvalMessage> aMessage =
std::dynamic_pointer_cast<ModelAPI_AttributeEvalMessage>(theMessage);
- FeaturePtr aParamFeature =
+ FeaturePtr aParamFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(aMessage->attribute()->owner());
if (aMessage->attribute()->attributeType() == ModelAPI_AttributeInteger::typeId()) {
AttributeIntegerPtr anAttribute =
bool isValid = anError.empty();
if (isValid)
anAttribute->setCalculatedValue(aValue);
- anAttribute->setUsedParameters(isValid ?
+ anAttribute->setUsedParameters(isValid ?
toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
anAttribute->setExpressionInvalid(!isValid);
anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError);
bool isValid = anError.empty();
if (isValid)
anAttribute->setCalculatedValue(aValue);
- anAttribute->setUsedParameters(isValid ?
+ anAttribute->setUsedParameters(isValid ?
toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
anAttribute->setExpressionInvalid(!isValid);
anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError);
double aValue = evaluate(aParamFeature, aText[i], anError);
bool isValid = anError.empty();
if (isValid) aCalculatedValue[i] = aValue;
- anAttribute->setUsedParameters(i,
+ anAttribute->setUsedParameters(i,
isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
anAttribute->setExpressionInvalid(i, !isValid);
anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError);
double aValue = evaluate(aParamFeature, aText[i], anError);
bool isValid = anError.empty();
if (isValid) aCalculatedValue[i] = aValue;
- anAttribute->setUsedParameters(i,
+ anAttribute->setUsedParameters(i,
isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
anAttribute->setExpressionInvalid(i, !isValid);
anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError);
anExpressionString = renameInPythonExpression(anExpressionString,
theOldName,
theNewName);
- // Issue #588. No need for reevaluating expression.
+ // Issue #588. No need for reevaluating expression.
// Moreover, current history may not contain necessary parameters.
anExpressionAttribute->owner()->data()->blockSendAttributeUpdated(true);
anExpressionAttribute->setValue(anExpressionString);
theResultParameter->data()->setName(theName);
theResultParameter->data()->blockSendAttributeUpdated(false, false);
- std::shared_ptr<ParametersPlugin_Parameter> aParameter =
+ std::shared_ptr<ParametersPlugin_Parameter> aParameter =
std::dynamic_pointer_cast<ParametersPlugin_Parameter>(
ModelAPI_Feature::feature(theResultParameter));
// check if the renamed object is a result parameter
ResultParameterPtr aResultParameter =
std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aMessage->object());
- if (!aResultParameter.get())
+ if (!aResultParameter.get())
return;
// get parameter feature for the result
// try to update the parameter feature according the new name
setParameterName(aResultParameter, aMessage->newName());
- // TODO(spo): replace with
- // ModelAPI_Session::get()->validators()->validate(aParameter,
+ // TODO(spo): replace with
+ // ModelAPI_Session::get()->validators()->validate(aParameter,
// ParametersPlugin_Parameter::VARIABLE_ID())
// when ModelAPI_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>& theFeature,
// const std::string& theAttribute) const
PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
/// Reimplemented from Events_Listener::processEvent().
- PARAMETERSPLUGIN_EXPORT
+ PARAMETERSPLUGIN_EXPORT
virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
protected:
aFactory->registerValidator("Parameters_ExpressionValidator",
new ParametersPlugin_ExpressionValidator);
- myEvalListener =
+ myEvalListener =
std::shared_ptr<ParametersPlugin_EvalListener>(new ParametersPlugin_EvalListener());
}
PyObject* aBuiltinModule = PyImport_AddModule("__builtin__");
PyDict_SetItemString(aContext, "__builtins__", aBuiltinModule);
- // extend aContext with variables
+ // extend aContext with variables
PyDict_SetItemString(aContext, "expression", PyString_FromString(theExpression.c_str()));
PyDict_SetItemString(aContext, "name", PyString_FromString(theName.c_str()));
PyDict_SetItemString(aContext, "positions", Py_BuildValue("[]"));
}
PyObject *aCodePyObj =
- PyObject_CallMethod(aCodeopModule, (char*)"compile_command", (char*)"(s)",
+ PyObject_CallMethod(aCodeopModule, (char*)"compile_command", (char*)"(s)",
theExpression.c_str());
if(!aCodePyObj || aCodePyObj == Py_None || !PyCode_Check(aCodePyObj)) {
} catch (const std::invalid_argument&) {
theError = "Unable to eval " + anEvalStr;
}
-
+
return result;
}
if (!ModelAPI_Expression::isVariable(aStrAttr->value())) {
theError = "Incorrect variable name.";
return false;
- }
+ }
if (!isUnique(theAttribute, aStrAttr->value())) {
theError = "Variable name is not unique.";
return false;
}
-ModuleBase_ModelWidget*
+ModuleBase_ModelWidget*
ParametersPlugin_WidgetCreator::createWidgetByType(const std::string& theType,
QWidget* theParent,
Config_WidgetAPI* theWidgetApi,
public:
/// Constructor
/// \param thaParent a parent
- ParametersPlugin_ItemDelegate(QObject* thaParent) :
+ ParametersPlugin_ItemDelegate(QObject* thaParent) :
QStyledItemDelegate(thaParent) {}
/// Redefinition of virtual method
/// \param painter a painter object
/// \param option the item options
/// \param index the current index
- virtual void paint(QPainter* painter,
- const QStyleOptionViewItem& option,
+ virtual void paint(QPainter* painter,
+ const QStyleOptionViewItem& option,
const QModelIndex& index ) const;
-
+
/// Redefinition of virtual method
/// \param parent a parent widget
/// \param option the item options
/// \param index the current index
- virtual QWidget* createEditor(QWidget* parent,
- const QStyleOptionViewItem& option,
+ virtual QWidget* createEditor(QWidget* parent,
+ const QStyleOptionViewItem& option,
const QModelIndex& index) const;
/// Returns True if the given index is editable item
return true;
}
-void ParametersPlugin_ItemDelegate::paint(QPainter* painter,
- const QStyleOptionViewItem& option,
+void ParametersPlugin_ItemDelegate::paint(QPainter* painter,
+ const QStyleOptionViewItem& option,
const QModelIndex& index ) const
{
QBrush aBrush = painter->brush();
painter->setBrush(aBrush);
}
-QWidget* ParametersPlugin_ItemDelegate::createEditor(QWidget* parent,
- const QStyleOptionViewItem& option,
+QWidget* ParametersPlugin_ItemDelegate::createEditor(QWidget* parent,
+ const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
myEditingIdx = index;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
-void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor,
+void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor,
QAbstractItemDelegate::EndEditHint theHint)
{
if (theHint == QAbstractItemDelegate::EditNextItem) {
/////////////////////////////////////////////////////////////////////////////////////////////////
-ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent,
+ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent,
const Config_WidgetAPI* theData)
: ModuleBase_ModelDialogWidget(theParent, theData)
{
connect(myTable, SIGNAL(itemSelectionChanged()), SLOT(onSelectionChanged()));
myDelegate = new ParametersPlugin_ItemDelegate(myTable);
- connect(myDelegate, SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
+ connect(myDelegate, SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
SLOT(onCloseEditor(QWidget*, QAbstractItemDelegate::EndEditHint)));
myTable->setItemDelegate(myDelegate);
QModelIndex aParent = myTable->model()->index(0, 0);
int aChildIdx = myParameters->indexOfChild(aItem);
QModelIndex aIndex = myTable->model()->index(aChildIdx, Col_Name, aParent);
- myTable->selectionModel()->select(aIndex,
+ myTable->selectionModel()->select(aIndex,
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
myTable->scrollToItem(aItem);
}
}
}
-void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor,
+void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor,
QAbstractItemDelegate::EndEditHint theHint)
{
FeaturePtr aFeature = myParametersList.at(myDelegate->editIndex().row());
}
aStringAttr->setValue(aText.toStdString());
isModified = true;
- }
+ }
}
break;
case Col_Equation:
{
- AttributeStringPtr aStringAttr =
+ AttributeStringPtr aStringAttr =
aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID());
if (!aText.isEmpty()) {
if (aText != aStringAttr->value().c_str()) {
if (aColumn != Col_Comment)
updateParametersPart();
updateFeaturesPart();
-
+
onSelectionChanged();
}
-void ParametersPlugin_WidgetParamsMgr::updateItem(QTreeWidgetItem* theItem,
+void ParametersPlugin_WidgetParamsMgr::updateItem(QTreeWidgetItem* theItem,
const QList<QStringList>& theFeaturesList)
{
if (theFeaturesList.count() != theItem->childCount()) {
if (theItem->childCount() < theFeaturesList.count()) {
- while (theItem->childCount() != theFeaturesList.count())
+ while (theItem->childCount() != theFeaturesList.count())
theItem->addChild(createNewItem(theItem));
} else {
- while (theItem->childCount() != theFeaturesList.count())
+ while (theItem->childCount() != theFeaturesList.count())
theItem->removeChild(theItem->child(theItem->childCount() - 1));
}
}
QTreeWidgetItem* aItem = new QTreeWidgetItem(aValues);
if (theParent == myParameters)
aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
- else
+ else
aItem->setFlags(Qt::NoItemFlags);
return aItem;
}
return;
myParametersList.append(aFeature);
- updateParametersPart();
+ updateParametersPart();
QTreeWidgetItem* aItem = myParameters->child(myParameters->childCount() - 1);
void ParametersPlugin_WidgetParamsMgr::enableButtons(bool theEnable)
{
myAddBtn->setEnabled(theEnable);
- if (theEnable)
+ if (theEnable)
onSelectionChanged();
else {
myInsertBtn->setEnabled(theEnable);
bool aIsValid = true;
for(int i = 0; i < myParameters->childCount(); i++) {
aItem = myParameters->child(i);
- if ((aItem->text(Col_Name) == NoName) ||
+ if ((aItem->text(Col_Name) == NoName) ||
(aItem->text(Col_Equation) == NoValue) ||
(!ModelAPI_Expression::isVariable(aItem->text(Col_Name).toStdString())) ) {
aIsValid = false;
/// Enable or disable buttons for parameters managemnt
void enableButtons(bool theEnable);
- QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures,
+ QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures,
QList<FeaturePtr>& theFeatureList) const;
QList<QStringList> parametersItems(const QList<FeaturePtr>& theFeatures) const;
#endif
#endif
-#endif //PARTSET_H\r
\ No newline at end of file
+#endif //PARTSET_H
AISObjectPtr anOperationPrs;
if (myPresentations.contains(theFlag))
anOperationPrs = myPresentations[theFlag];
-
+
if (!anOperationPrs.get() && theToCreate) {
initPresentation(theFlag);
anOperationPrs = myPresentations[theFlag];
bool aRedisplayed = false;
if (myIsActive[theFlag])
aRedisplayed = displayPresentation(theFlag, theUpdateViewer);
-
+
return aRedisplayed;
}
QString aIsExternal(theExternal.c_str());
if (!aIsExternal.isEmpty()) {
QString aStr = aIsExternal.toUpper();
- myUseExternal = (aStr == "TRUE") || (aStr == "YES");
+ myUseExternal = (aStr == "TRUE") || (aStr == "YES");
}
QString aCanCreateExternal(theCanCreateExternal.c_str());
if (!aCanCreateExternal.isEmpty()) {
QString aStr = aCanCreateExternal.toUpper();
- myCanCreateExternal = (aStr == "TRUE") || (aStr == "YES");
+ myCanCreateExternal = (aStr == "TRUE") || (aStr == "YES");
}
}
bool aValid = true;
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
// Do check using of external feature
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
// Do check that we can use external feature
if (aFeature.get() != NULL) {
QObjectPtrList anObjects;
anObjects.append(aFeature);
- // the external feature should be removed with all references,
+ // the external feature should be removed with all references,
// composite sketch feature will be ignored
workshop(theWorkshop)->deleteFeatures(anObjects);
}
ResultPtr aResult = myWorkshop->selection()->getResult(aPrs);
// to filter infinite construction results
if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (aConstruction.get() && aConstruction->isInfinite()) {
Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
TopoDS_Shape aResultTopoShape = aResultShape->impl<TopoDS_Shape>();
aResultShapeType = aResultTopoShape.ShapeType();
}
- // for infinite object, the selection is possible only
+ // for infinite object, the selection is possible only
// for shapes of owners, which are coincide
- // to the shape of corresponded AIS object.
+ // to the shape of corresponded AIS object.
// In other words, for axis, only edge can be selected
// (vertices are not selectable), for planes,
// only faces can be selected (not edges or vertices)
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean
+ Standard_EXPORT virtual Standard_Boolean
IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(PartSet_FilterInfinite)
if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
if (theOwner->HasSelectable()) {
- Handle(AIS_InteractiveObject) aAisObj =
+ Handle(AIS_InteractiveObject) aAisObj =
Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
if (!aAisObj.IsNull()) {
aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
if (aFeature) {
aValid = aFeature->getKind() != "Group";
- } else
+ } else
aValid = Standard_True;
}
} else
IMPLEMENT_STANDARD_HANDLE(PartSet_CirclePointFilter, SelectMgr_Filter);
IMPLEMENT_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter);
-Standard_Boolean
+Standard_Boolean
PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
return Standard_True;
}
- Handle(ModuleBase_ResultPrs) aResultPrs =
+ Handle(ModuleBase_ResultPrs) aResultPrs =
Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable());
if(aResultPrs.IsNull()) {
return Standard_True;
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean
+ Standard_EXPORT virtual Standard_Boolean
IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(PartSet_GlobalFilter)
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean
+ Standard_EXPORT virtual Standard_Boolean
IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(PartSet_CirclePointFilter)
PartSet_IconFactory::PartSet_IconFactory():ModuleBase_IconFactory()
{
- Events_Loop::loop()->registerListener(this,
+ Events_Loop::loop()->registerListener(this,
Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT()));
}
anIconString);
}
break;
- default: break;
+ default: break;
}
- }
+ }
if (theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated)
return QIcon(":pictures/constr_object_modified.png");
void PartSet_IconFactory::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- if (theMessage->eventID() ==
+ if (theMessage->eventID() ==
Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
connect(aSubMenu, SIGNAL(hovered(QAction*)), SLOT(onLineHighlighted(QAction*)));
connect(aSubMenu, SIGNAL(aboutToHide()), SLOT(onDetachMenuHide()));
connect(aSubMenu, SIGNAL(triggered(QAction*)), SLOT(onLineDetach(QAction*)));
- }
+ }
}
}
}
}
-void addRefCoincidentFeatures(const std::set<AttributePtr>& theRefList,
+void addRefCoincidentFeatures(const std::set<AttributePtr>& theRefList,
std::shared_ptr<GeomAPI_Pnt2d>& theRefPnt,
QObjectPtrList& theOutList)
{
for (aIt = theRefList.cbegin(); aIt != theRefList.cend(); ++aIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
- if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
+ if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = PartSet_Tools::getCoincedencePoint(aConstrFeature);
if (aPnt.get() == NULL)
return;
gp_Pnt aP = aPnt->impl<gp_Pnt>();
if (theRefPnt->isEqual(aPnt) && (!theOutList.contains(aConstrFeature))) {
theOutList.append(aConstrFeature);
- }
+ }
}
}
}
std::shared_ptr<GeomAPI_Pnt2d> aOrig = PartSet_Tools::getCoincedencePoint(mySelectedFeature);
if (!aOrig.get())
return;
-
+
const std::set<AttributePtr>& aRefsList = aLine->data()->refsToMe();
QObjectPtrList aToDelFeatures;
anOpMgr->startOperation(anOpAction);
aWorkshop->deleteFeatures(aToDelFeatures);
-
+
anOpMgr->commitOperation();
}
myCoinsideLines.clear();
myPrevId = -1;
}
-
+
void PartSet_MenuMgr::setAuxiliary(const bool isChecked)
{
ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
if (aSketchFeature.get() != NULL) {
std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
- std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
+ std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
aSketchFeature->data()->attribute(anAttribute));
if (anAuxiliaryAttr)
if (aSketchFeature.get() != NULL) {
std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
- std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
+ std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
aSketchFeature->data()->attribute(anAttribute));
if (anAuxiliaryAttr)
QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjects.first());
if (aFeature == NULL) {
- ResultParameterPtr aParam =
+ ResultParameterPtr aParam =
std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObjects.first());
if (aParam.get() != NULL) {
aFeature = ModelAPI_Feature::feature(aParam);
/// Add menu items for viewer into the actions map
/// \param theStdActions a map of standard actions
- /// \param theParent a parent widget for the
+ /// \param theParent a parent widget for the
/// \param theMenuActions map of action/menu for the desirable index in the viewer menu
/// \return true if items are added and there is no necessity to provide standard menu
bool addViewerMenu(const QMap<QString, QAction*>& theStdActions,
/// Update state of pop-up menu items in viewer
/// \param theStdActions - a map of standard actions
- void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
+ void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
/// Activates a PartSet document
void activatePartSet() const;
/// \param theValue the current auxiliary value
/// \return the boolean result
bool canSetAuxiliary(bool& theValue) const;
-
+
/// Changes the sketcher entity construction argument value
/// \param isChecked if true, the feature is a construction
void setAuxiliary(const bool isChecked);
PartSet_Module* myModule;
/// the popup menu actions
- QMap<QString, QAction*> myActions;
+ QMap<QString, QAction*> myActions;
/// List of lines coincided in a one point
mutable QList<FeaturePtr> myCoinsideLines;
/// Id of menu item in Detach menu previously selected
int myPrevId;
- /// Original color of highlighted line
+ /// Original color of highlighted line
QColor myColor;
};
PLANE_SIZE);
Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness",
Config_Prop::Integer, SKETCH_WIDTH);
- Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
+ Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
"Rotate to plane when selected", Config_Prop::Boolean, "false");
}
-void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
+void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
const bool isToConnect)
{
mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
}
-void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
+void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
{
if (sketchMgr()->isNestedSketchOperation(theOperation)) {
mySketchMgr->commitNestedSketch(theOperation);
/// Restart sketcher operations automatically
if (!mySketchReentrantMgr->operationCommitted(theOperation)) {
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation && !aFOperation->isEditOperation()) {
// the selection is cleared after commit the create operation
bool isOperationCommitted = false;
if (!aFOperation->isEditOperation()) {
std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(workshop(), aFeature);
- // if there is a greed attribute, automatic commit by preselection
+ // if there is a greed attribute, automatic commit by preselection
// for this feature is prohibited
aFilledWidget = aFOperation->activateByPreselection(aGreedAttributeId);
if (currentOperation() != aFOperation)
else {
if (aGreedAttributeId.empty()) {
// a signal should be emitted before the next widget activation
- // because, the activation of the next widget will give a focus to the widget.
- // As a result the value of the widget is initialized.
+ // because, the activation of the next widget will give a focus to the widget.
+ // As a result the value of the widget is initialized.
// And commit may happens until the value is entered.
if (aFilledWidget) {
if (mySketchReentrantMgr->canBeCommittedByPreselection())
{
ModuleBase_IModule::operationResumed(theOperation);
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation) {
myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
aDisplayer->updateViewer();
}
- QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator
+ QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator
anIt = myHasConstraintShown.begin(), aLast = myHasConstraintShown.end();
for (; anIt != aLast; anIt++) {
mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value());
if (isSketchOp || isNestedOp) {
// in active sketch operation it is possible to activate operation object in selection
// in the edit operation, e.g. points of the line can be moved when the line is edited
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation());
}
{
bool aProcessed = false;
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
XGUI_Workshop* aWorkshop = getWorkshop();
XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
FeaturePtr anOpFeature = aFOperation->feature();
GeomShapePtr aShape = aSelectedPrs->shape();
- // click on the digit of dimension constrain comes here
+ // click on the digit of dimension constrain comes here
// with an empty shape, so we need the check
if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) {
const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
if (aFeature) {
std::string aId = aFeature->getKind();
if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
- (aId == SketchPlugin_ConstraintLength::ID()) ||
+ (aId == SketchPlugin_ConstraintLength::ID()) ||
(aId == SketchPlugin_ConstraintDistance::ID()) ||
(aId == SketchPlugin_ConstraintAngle::ID())) {
editFeature(aFeature);
}
}
}
- }
+ }
}
void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
anOpMgr->startOperation(anOpAction);
// WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects
- // the problem is in AIS Dimensions recompute
+ // the problem is in AIS Dimensions recompute
// if a line and the dim are removed, line is the first
- // it causes the AIS recompute, where the base line is null,
+ // it causes the AIS recompute, where the base line is null,
// the result is empty AIS in the viewer
XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection();
void PartSet_Module::storeConstraintsState(const std::string& theFeatureKind)
{
- if (myWorkshop->currentOperation() &&
+ if (myWorkshop->currentOperation() &&
myWorkshop->currentOperation()->id().toStdString() == SketchPlugin_Sketch::ID()) {
const QMap<PartSet_Tools::ConstraintVisibleState, bool>& aShownStates =
mySketchMgr->showConstraintStates();
}
}
-void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
+void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
{
Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull()) {
Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
Handle(V3d_View) aView;
double aScale = 0;
- for (aV3dViewer->InitDefinedViews();
- aV3dViewer->MoreDefinedViews();
+ for (aV3dViewer->InitDefinedViews();
+ aV3dViewer->MoreDefinedViews();
aV3dViewer->NextDefinedViews()) {
Handle(V3d_View) aV = aV3dViewer->DefinedView();
double aS = aV->Scale();
return myCustomPrs->isActive(theFlag);
}
-void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature,
+void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature,
const ModuleBase_CustomizeFlag& theFlag,
const bool theUpdateViewer)
{
if (aOB) {
QLabel* aLabel = aOB->activeDocLabel();
aLabel->installEventFilter(myMenuMgr);
- connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)),
+ connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)),
SLOT(onActiveDocPopup(const QPoint&)));
//QPalette aPalet = aLabel->palette();
//aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
//aLabel->setPalette(aPalet);
aOB->treeView()->setExpandsOnDoubleClick(false);
- connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
+ connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
SLOT(onTreeViewDoubleClick(const QModelIndex&)));
}
}
// if there is an active widget, find the presented object in it
if (!anActiveWidget)
anActiveWidget = aPanel->preselectionWidget();
-
+
ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
(anActiveWidget);
if (aWidgetValidated)
bool aCanBeShaged = true;
Handle(PartSet_ResultSketchPrs) aPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theAIS);
- if (!aPrs.IsNull())
+ if (!aPrs.IsNull())
aCanBeShaged = false;
return aCanBeShaged;
if (aObject) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
- bool isPart = aPart.get() ||
+ bool isPart = aPart.get() ||
(aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID()));
if (isPart) {
DocumentPtr aPartDoc;
}
if (aPart.get()) // this may be null is Part feature is disabled
aPartDoc = aPart->partDoc();
-
+
theMenu->addAction(aActivatePartAction);
aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
// Do not change activation of parts if an operation active
static QStringList aAllowActivationList;
if (aAllowActivationList.isEmpty())
- aAllowActivationList <<
- QString(PartSetPlugin_Part::ID().c_str()) <<
+ aAllowActivationList <<
+ QString(PartSetPlugin_Part::ID().c_str()) <<
QString(PartSetPlugin_Duplicate::ID().c_str()) <<
QString(PartSetPlugin_Remove::ID().c_str());
- if (myWorkshop->currentOperation() &&
+ if (myWorkshop->currentOperation() &&
(!aAllowActivationList.contains(myWorkshop->currentOperation()->id())))
return;
XGUI_Workshop* aWorkshop = getWorkshop();
bool aHidden;
foreach(ObjectPtr aObj, aObjects) {
//TODO: replace by redisplay event.
- aHidden = !aObj->data() || !aObj->data()->isValid() ||
+ aHidden = !aObj->data() || !aObj->data()->isValid() ||
aObj->isDisabled() || (!aObj->isDisplayed());
if (!aHidden)
aDisplayer->redisplay(aObj, false);
if (aOperation) {
ModuleBase_ModelWidget* anActiveWidget = activeWidget();
if (anActiveWidget) {
- ModuleBase_WidgetSelector* aWSelector =
+ ModuleBase_WidgetSelector* aWSelector =
dynamic_cast<ModuleBase_WidgetSelector*>(anActiveWidget);
if (aWSelector)
aWSelector->activateSelectionAndFilters(true);
if (aGeomShape.get()) {
TopoDS_Shape aTDSShape = aGeomShape->impl<TopoDS_Shape>();
- return PartSet_Tools::findAttributeBy2dPoint(theObject, aTDSShape,
+ return PartSet_Tools::findAttributeBy2dPoint(theObject, aTDSShape,
mySketchMgr->activeSketch());
}
return anAttribute;
enum RestartingMode {
RM_None, /// the operation should not be restarted
RM_Forbided, /// the operation should not be restarted after there is no active widget
- RM_LastFeatureUsed, /// the operation is restarted and use the previous feature
+ RM_LastFeatureUsed, /// the operation is restarted and use the previous feature
/// for own initialization
RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature
};
/// Call back forlast tuning of property panel before operation performance
virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
- /// If there is found selected attribute, widgets are created and contains
+ /// If there is found selected attribute, widgets are created and contains
/// only a widget for the attribute
/// It is important for Property Panel filling by sketch point attribute
/// \param theOperation a started operation
virtual bool createWidgets(ModuleBase_Operation* theOperation,
QList<ModuleBase_ModelWidget*>& theWidgets) const;
- /// Launching of a edit operation on the feature
+ /// Launching of a edit operation on the feature
/// \param theFeature feature for editing
virtual void editFeature(FeaturePtr theFeature);
/// Update state of pop-up menu items in viewer
/// \param theStdActions - a map of standard actions
- virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
+ virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
/// Returns true if the action should be always enabled
/// \param theActionId an action index: Accept or Accept All
/// Processing the mouse release event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow,
+ PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow,
QMouseEvent* theEvent) {}
/// Processing the mouse double click event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow,
+ PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow,
QMouseEvent* theEvent) {}
};
void PartSet_OperationPrs::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
#ifdef DEBUG_OPERATION_PRS
BRep_Builder aBuilder;
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
- for(NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>::Iterator
+ for(NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>::Iterator
anIter(myShapeToPrsMap); anIter.More(); anIter.Next()) {
const TopoDS_Shape& aShape = anIter.Key();
aBuilder.Add(aComp, aShape);
}
Set(aComp);
if (!aReadyToDisplay) {
- Events_InfoMessage("PartSet_OperationPrs",
+ Events_InfoMessage("PartSet_OperationPrs",
"An empty AIS presentation: PartSet_OperationPrs").send();
std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)));
if (theObject.get()) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get()) {
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
if (aCompsolidResult->numberOfSubs() > 0) {
else {
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get()) {
- AttributeBooleanPtr aCopyAttr =
+ AttributeBooleanPtr aCopyAttr =
aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID());
if (aCopyAttr.get()) {
bool isCopy = aCopyAttr->value();
std::string anAttrType = anAttribute->attributeType();
if (anAttrType == ModelAPI_AttributeSelectionList::typeId()) {
- std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
for(int i = 0; i < aCurSelList->size(); i++) {
std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
ObjectPtr anObject;
GeomShapePtr aShape;
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr =
+ AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttribute);
if (anAttr->isObject()) {
anObject = anAttr->object();
}
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
anObject = anAttr->context();
aShape = anAttr->value();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr =
+ AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(anAttribute);
anObject = anAttr->value();
}
}
void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
- QMap<ObjectPtr,
+ QMap<ObjectPtr,
QList<GeomShapePtr> >& theObjectShapes)
{
theObjectShapes.clear();
void PartSet_OperationPrs::fillShapeList(
const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
ModuleBase_IWorkshop* theWorkshop,
- NCollection_DataMap<TopoDS_Shape,
+ NCollection_DataMap<TopoDS_Shape,
Handle(AIS_InteractiveObject)>& theShapeToPrsMap)
{
theShapeToPrsMap.Clear();
getConflictingColor(aColor);
// set error state for new objects and append them in the internal map of objects
- std::set<ObjectPtr>::const_iterator
+ std::set<ObjectPtr>::const_iterator
anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
std::set<ObjectPtr> aModifiedObjects;
// erase error state of absent current objects in the parameter list
std::set<ObjectPtr>::const_iterator anIt, aLast;
- for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+ for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found
/// \param theObject an object to be checked
/// \return boolean result
bool isConflictingObject(const ObjectPtr& theObject);
-
+
/// Returns values of conflicting color
/// \param theColor the output container to be filled in [red, green, blue] values
void getConflictingColor(std::vector<int>& theColor);
myPreviewDisplayed = true;
}
-AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
- std::shared_ptr<GeomAPI_Dir> theNorm,
+AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
+ std::shared_ptr<GeomAPI_Dir> theNorm,
const int theRGB[3])
{
double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size", PLANE_SIZE);
- std::shared_ptr<GeomAPI_Shape> aFace =
+ std::shared_ptr<GeomAPI_Shape> aFace =
GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize);
AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject());
aAIS->createShape(aFace);
/// \param theOrigin an origin of the plane
/// \param theNorm a normal vector of the plane
/// \param theRGB a color of plane presentation [r, g, b] array
- AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
- std::shared_ptr<GeomAPI_Dir> theNorm,
+ AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
+ std::shared_ptr<GeomAPI_Dir> theNorm,
const int theRGB[3]);
private:
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
Set(aShape);
Handle(Prs3d_Drawer) aDrawer = Attributes();
- if (aDrawer->HasOwnPointAspect())
+ if (aDrawer->HasOwnPointAspect())
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
void PartSet_ResultSketchPrs::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
thePresentation->Clear();
}
if (!aReadyToDisplay) {
- Events_InfoMessage("PartSet_ResultSketchPrs",
+ Events_InfoMessage("PartSet_ResultSketchPrs",
"An empty AIS presentation: PartSet_ResultSketchPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
TopTools_IndexedMapOfShape aSubShapes;
TopExp::MapShapes (theShape, theType, aSubShapes);
- Standard_Boolean
+ Standard_Boolean
isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1)));
int anExtent = aSubShapes.Extent();
for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); ++aShIndex)
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
aBuilder.Add(aComp, myOriginalShape);
-
+
for(NCollection_List<TopoDS_Shape>::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFace = anIt.Value();
aBuilder.Add(aComp, aFace);
void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle(const bool isAuxiliary)
{
- Standard_Integer aLineStyle = isAuxiliary?
- SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY() :
+ Standard_Integer aLineStyle = isAuxiliary?
+ SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY() :
SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
Handle(Prs3d_Drawer) aDrawer = Attributes();
return;
theFaceList.Clear();
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myResult);
if (aConstruction.get()) {
int aFacesNum = aConstruction->facesNum();
/// \param theShape a shape
/// \param theTypeOfSelection type of selection: VERTEX, EDGE, WIRE
void appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection,
- const TopoDS_Shape& theShape,
+ const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum& theTypeOfSelection);
/// Sets color/line style/width of the presentation depending on the parameter state
//#define DEBUG_CURSOR
/// Fills attribute and result lists by the selected owner. In case if the attribute is found,
-/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge,
+/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge,
/// put the function result as is to the list of results.
/// \param theOwner a viewer selected owner
/// \param theFeature a feature, where the attribute is searched
restoreSelection();
myCurrentSelection.clear();
- // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
+ // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
// viewer happens by deselect/select the modified objects. The flag should be restored after
// the selection processing. The update viewer should be also called.
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
restoreSelection();
launchEditing();
if (aFeature.get() != NULL) {
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature.get() &&
+ if (aSPFeature.get() &&
(aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID() ||
aSPFeature->getKind() == SketchPlugin_ConstraintAngle::ID())) {
DataPtr aData = aSPFeature->data();
AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
- std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
}
restoreSelection();
launchEditing();
if (aFeature.get() != NULL) {
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature.get() &&
+ if (aSPFeature.get() &&
(aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID() ||
aSPFeature->getKind() == SketchPlugin_ConstraintAngle::ID())) {
DataPtr aData = aSPFeature->data();
AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
- std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
}
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
- // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
+ // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
// viewer happens by deselect/select the modified objects. The flag should be restored after
// the selection processing. The update viewer should be also called.
bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
std::string aAttrId = anAttr->id();
DataPtr aData = aFeature->data();
if (aData->isValid()) {
- std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
if (aPoint.get() != NULL) {
bool isImmutable = aPoint->setImmutable(true);
myIsPopupMenuActive = false;
}
-void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
+void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
Point& thePoint)
{
Handle(V3d_View) aView = theWnd->v3dView();
{
if (!myCurrentSelection.empty()) {
FeaturePtr aFeature = myCurrentSelection.begin().key();
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSPFeature && (!aSPFeature->isExternal())) {
myModule->editFeature(aSPFeature);
myModule->workshop()->viewer()->addSelectionFilter(myCirclePointFilter);
- if (myPlaneFilter.IsNull())
+ if (myPlaneFilter.IsNull())
myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
}
if (!aFOperation->isDisplayedOnStart(myCurrentSketch))
myCurrentSketch->setDisplayed(true);
-
+
myCurrentSketch = CompositeFeaturePtr();
myModule->workshop()->viewer()->removeSelectionFilter(myCirclePointFilter);
bool aHasActiveSketch = activeSketch().get() != NULL;
if (aHasActiveSketch) {
// 1. the sketch feature should not be displayed during the sketch active operation
- // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch
+ // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch
// nested features can be visualized
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get() != NULL && aFeature == activeSketch()) {
#ifndef DEBUG_DO_NOT_BY_ENTER
if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) {
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- ModuleBase_WidgetEditor* anEditorWdg =
+ ModuleBase_WidgetEditor* anEditorWdg =
anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
// the active widget editor should not influence here. The presentation should be visible
// always when this widget is active.
if (!anEditorWdg && !myIsPopupMenuActive) {
- // during a nested create operation, the feature is redisplayed only
+ // during a nested create operation, the feature is redisplayed only
// if the mouse over view
// of there was a value modified in the property panel after the mouse left the view
aCanDisplay = canDisplayCurrentCreatedFeature();
void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln)
{
- if (myPlaneFilter.IsNull())
+ if (myPlaneFilter.IsNull())
myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
myPlaneFilter->setPlane(thePln);
ResultPtr aResult = *aIt;
AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult);
if (aAISObj.get() == NULL)
- continue;
+ continue;
Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
- SelectMgr_IndexedMapOfOwner aSelectedOwners;
+ SelectMgr_IndexedMapOfOwner aSelectedOwners;
aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners);
for ( Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) {
- Handle(StdSelect_BRepOwner) anOwner =
+ Handle(StdSelect_BRepOwner) anOwner =
Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i));
if ( anOwner.IsNull() || !anOwner->HasShape() )
continue;
const TopoDS_Shape& aShape = anOwner->Shape();
TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
if (aShapeType == TopAbs_VERTEX) {
- AttributePtr aPntAttr =
+ AttributePtr aPntAttr =
PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch);
if (aPntAttr.get() != NULL &&
aSelectedAttributes.find(aPntAttr) != aSelectedAttributes.end()) {
}
}
-void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
+void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
const bool isToConnect)
{
if (isToConnect) {
// 1. it is necessary to save current selection in order to restore it after the features moving
myCurrentSelection.clear();
- QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = aStoredPrs.begin(),
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = aStoredPrs.begin(),
aLast = aStoredPrs.end();
CompositeFeaturePtr aSketch = activeSketch();
std::set<AttributePtr> aSelectedAttributes;
std::set<ResultPtr> aSelectedResults;
if (myCurrentSelection.find(aFeature) != myCurrentSelection.end()) {
- std::pair<std::set<AttributePtr>, std::set<ResultPtr> > aPair =
+ std::pair<std::set<AttributePtr>, std::set<ResultPtr> > aPair =
myCurrentSelection.find(aFeature).value();
aSelectedAttributes = aPair.first;
aSelectedResults = aPair.second;
// 3. External objects (violet color)
// 4. Auxiliary segments (dotted)
// StdSelect_BRepSelectionTool::Load uses priority calculating:
- // Standard_Integer aPriority =
+ // Standard_Integer aPriority =
// (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
// Priority of Vertex is 8, edge(segment) is 7.
// It might be not corrected as provides the condition above.
/// \param theOperation an operation
bool canChangeCursor(ModuleBase_Operation* theOperation) const;
- /// Returns state of constraints showing flag
+ /// Returns state of constraints showing flag
const QMap<PartSet_Tools::ConstraintVisibleState, bool>& showConstraintStates();
/// Returns true if the object is a current sketch sub feature of a result of the feature
bool isObjectOfSketch(const ObjectPtr& theObject) const;
/// Saves the current selection in the viewer into an internal container
- /// It obtains the selected attributes.
+ /// It obtains the selected attributes.
/// The highlighted objects can be processes as the selected ones
/// \param theHighlightedOnly a boolean flag
void storeSelection(const bool theHighlightedOnly = false);
void onLeaveViewPort();
/// Listens to the value changed signal and display the current operation feature
void onBeforeValuesChangedInPropertyPanel();
- /// Listens to the signal about the modification of the values
+ /// Listens to the signal about the modification of the values
/// have been done in the property panel
void onAfterValuesChangedInPropertyPanel();
/// Launches the operation from current highlighting
void launchEditing();
- /// Converts mouse position to 2d coordinates.
+ /// Converts mouse position to 2d coordinates.
/// Member myCurrentSketch has to be correctly defined
- void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
+ void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
Point& thePoint);
/// Show distance value editor if it is a distance operation and all attribute references
typedef QMap<FeaturePtr, std::pair<std::set<AttributePtr>, std::set<ResultPtr> > >
FeatureToSelectionMap;
- /// Applyes the current selection to the object in the workshop viewer
+ /// Applyes the current selection to the object in the workshop viewer
/// It includes the selection in all modes of activation, even local context - vertexes, edges
/// It gets all results of the feature, find an AIS object in the viewer and takes all BRep
/// selection owners. If the owner is vertex, the corresponded attribute is seached in
SelectMgr_IndexedMapOfOwner& anOwnersToSelect);
/// Returns true if the created feature is visible
- /// \param
+ /// \param
bool isVisibleCreatedFeature() const;
/// Returns a current operation
/// Erase or display the feature of the current operation. If the mouse over the active view or
/// a current value is changed by property panel, the feature is displayed otherwise it is hidden
- /// \param theOperation an operation which feature is to be displayed,
+ /// \param theOperation an operation which feature is to be displayed,
/// it is nested create operation
/// \param isToDisplay a flag about the display or erase the feature
void visualizeFeature(const FeaturePtr& theFeature, const bool isEditOperation,
bool myDragDone;
bool myIsMouseOverWindow; /// the state that the mouse over the view
/// the state whether the over view state is processed by mouseMove method
- bool myIsMouseOverViewProcessed;
+ bool myIsMouseOverViewProcessed;
bool myIsPopupMenuActive; /// the state of the popup menu is shown
Point myCurrentPoint;
//Point myClickedPoint;
/// selection should be obtained from workshop before ask if the operation can be started as
/// the canStartOperation method performs commit/abort of previous operation.
/// Sometimes commit/abort
- /// may cause selection clear(Sketch operation) as a result
+ /// may cause selection clear(Sketch operation) as a result
/// it will be lost and is not used for preselection.
ModuleBase_ISelection* aSelection = myWorkshop->selection();
- QList<ModuleBase_ViewerPrsPtr> aPreSelected =
+ QList<ModuleBase_ViewerPrsPtr> aPreSelected =
aSelection->getSelected(ModuleBase_ISelection::AllControls);
restartOperation();
// fill the first widget by the mouse event point
// if the active widget is not the first, it means that the restarted operation is filled by
// the current preselection.
- PartSet_WidgetPoint2D* aPoint2DWdg =
+ PartSet_WidgetPoint2D* aPoint2DWdg =
dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
ModuleBase_ModelWidget* aFirstWidget = aPanel->findFirstAcceptingValueWidget();
if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) {
if (!isActiveMgr())
return;
- // we should avoid processing of the signal about no more widgets attributes and
+ // we should avoid processing of the signal about no more widgets attributes and
// do this after the restart operaion is finished if it was called
// onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
// if it should be called after restart
// if there is no the next widget to be automatically activated,
// the Ok button in property
// panel should accept the focus(example is parallel constraint on sketch lines)
- QToolButton* anOkBtn =
+ QToolButton* anOkBtn =
dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
if (anOkBtn)
anOkBtn->setFocus(Qt::TabFocusReason);
module()->launchOperation(aFOperation->id());
myIsFlagsBlocked = false;
resetFlags();
- // we should avoid processing of the signal about no more widgets attributes and
+ // we should avoid processing of the signal about no more widgets attributes and
// do this after the restart operaion is finished if it was called
// onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
// if it should be called after restart
void PartSet_SketcherReetntrantMgr::deleteInternalFeature()
{
if (myInternalActiveWidget) {
- ModuleBase_WidgetSelector* aWSelector =
+ ModuleBase_WidgetSelector* aWSelector =
dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
if (aWSelector)
aWSelector->activateSelectionAndFilters(false);
if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) {
// get the last point of the previuos arc feature(geom point 2d)
std::shared_ptr<ModelAPI_Data> aSData = theSourceFeature->data();
- std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aSData->attribute(SketchPlugin_Arc::END_ID()));
// get point attribute on the current feature
SketchPlugin_Arc::TANGENT_POINT_ID());
aTangentPointAttr->setAttr(aSPointAttr);
- std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y());
/// ('internal' edit operation), with the ability to simultaneously create the next entity
/// of same type (re-entrance of the operation).
/// OK valids the current edition and exits from the operation (no re-entrance).
-/// Cancel removes (undo) the entity currently edited and
+/// Cancel removes (undo) the entity currently edited and
/// exits from the operation (no re-entrance).
class PARTSET_EXPORT PartSet_SketcherReetntrantMgr : public QObject
{
enum RestartingMode {
RM_None, /// the operation should not be restarted
RM_Forbided, /// the operation should not be restarted after there is no active widget
- RM_LastFeatureUsed, /// the operation is restarted and use
+ RM_LastFeatureUsed, /// the operation is restarted and use
/// the previous feature for own initialization
RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature
};
bool isTangentArc(ModuleBase_Operation* theOperation,
const std::shared_ptr<ModelAPI_CompositeFeature>& /*theSketch*/) const;
- /// Accept All action is enabled if an internal edit is started.
+ /// Accept All action is enabled if an internal edit is started.
/// It updates the state of the button
void updateAcceptAllAction();
theY = aVec.X() * anY->x() + aVec.Y() * anY->y() + aVec.Z() * anY->z();
}
-std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::convertTo2D(FeaturePtr theSketch,
+std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::convertTo2D(FeaturePtr theSketch,
const std::shared_ptr<GeomAPI_Pnt>& thePnt)
{
std::shared_ptr<GeomAPI_Pnt2d> aRes;
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
std::shared_ptr<GeomAPI_Dir> aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
- std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY));
return aPnt2d->to3D(aC->pnt(), aX->dir(), aY);
ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
for (; anIt != aLast && !aFPoint; anIt++) {
- std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
if (aCurPoint && aCurPoint->isInitialized() &&
aValidators->isCase(theFeature, aCurPoint->id()) &&
return aResult;
}
-ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape,
- const ObjectPtr& theObject,
+ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape,
+ const ObjectPtr& theObject,
CompositeFeaturePtr theSketch,
const bool theTemporary)
{
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d2 = convertTo2D(theSketch, aPnt2);
std::shared_ptr<ModelAPI_Data> aData = aMyFeature->data();
- std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::START_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::END_ID()));
}
if (aMyFeature) {
DataPtr aData = aMyFeature->data();
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
// selection shape has no result owner => the trihedron axis
- // TODO: make reference to the real axes when
+ // TODO: make reference to the real axes when
// they are implemented in the initialization plugin
if (!aRes.get()) {
ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName(
ModelAPI_ResultConstruction::group(), "Origin");
if (aPointObj.get()) { // if initialization plugin performed well
aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
- }
+ }
}
if (!aRes.get()) {
aRes = aMyFeature->firstResult();
if (aMyFeature) {
DataPtr aData = aMyFeature->data();
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- // if there is no object,
+ // if there is no object,
// it means that this is the origin point: search it in the module document
if (!aRes.get()) {
ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName(
ModelAPI_ResultConstruction::group(), "Origin");
if (aPointObj.get()) { // if initialization plugin performed well
aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
- }
+ }
}
// reference to itself with name "Origin" (but this may cause the infinitive cycling)
if (!aRes.get()) {
// If the point is selected not from Result object
- std::shared_ptr<GeomAPI_Shape> aShape =
+ std::shared_ptr<GeomAPI_Shape> aShape =
std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(theShape));
- std::shared_ptr<GeomAPI_Vertex> aVertex =
+ std::shared_ptr<GeomAPI_Vertex> aVertex =
std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(aShape));
std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d = convertTo2D(theSketch, aPnt);
- std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Point::COORD_ID()));
aPoint->setValue(aPnt2d);
- if ((aPnt->x() < Precision::Confusion()) &&
+ if ((aPnt->x() < Precision::Confusion()) &&
(aPnt->y() < Precision::Confusion()) &&
(aPnt->z() < Precision::Confusion()))
aData->setName("Origin");
return false;
}
-ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch,
+ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch,
std::shared_ptr<GeomAPI_Edge> theEdge)
{
for (int i = 0; i < theSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = theSketch->subFeature(i);
- std::shared_ptr<SketchPlugin_Feature> aSketchFea =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFea =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
// not displayed result of feature projection should not be returned as external edge
if (aSketchFea && aSketchFea->canBeDisplayed()) {
std::list<ResultPtr> aResults = aSketchFea->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
- ResultConstructionPtr aRes =
+ ResultConstructionPtr aRes =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aIt);
if (aRes) {
std::shared_ptr<GeomAPI_Shape> aShape = aRes->shape();
}
-ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch,
+ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch,
std::shared_ptr<GeomAPI_Vertex> theVert)
{
for (int i = 0; i < theSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = theSketch->subFeature(i);
- std::shared_ptr<SketchPlugin_Feature> aSketchFea =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFea =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFea) {
if (aSketchFea->isExternal()) {
std::list<ResultPtr> aResults = aSketchFea->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
- ResultConstructionPtr aRes =
+ ResultConstructionPtr aRes =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aIt);
if (aRes) {
std::shared_ptr<GeomAPI_Shape> aShape = aRes->shape();
return std::shared_ptr<GeomAPI_Pnt2d>();
}
-FeaturePtr findFirstCoincidenceByData(const DataPtr& theData,
+FeaturePtr findFirstCoincidenceByData(const DataPtr& theData,
std::shared_ptr<GeomAPI_Pnt2d> thePoint)
{
FeaturePtr aCoincident;
for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
- if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
- std::shared_ptr<GeomAPI_Pnt2d> a2dPnt =
+ if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
+ std::shared_ptr<GeomAPI_Pnt2d> a2dPnt =
PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A());
- if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
+ if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
aCoincident = aConstrFeature;
break;
} else {
a2dPnt = PartSet_Tools::getPoint(aConstrFeature,
SketchPlugin_ConstraintCoincidence::ENTITY_B());
- if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
+ if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
aCoincident = aConstrFeature;
break;
}
for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
- if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
- std::shared_ptr<GeomAPI_Pnt2d> a2dPnt =
+ if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
+ std::shared_ptr<GeomAPI_Pnt2d> a2dPnt =
PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A());
- if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
+ if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
aCoincident = aConstrFeature;
break;
} else {
a2dPnt = PartSet_Tools::getPoint(aConstrFeature,
SketchPlugin_ConstraintCoincidence::ENTITY_B());
- if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
+ if (a2dPnt.get() && thePoint->isEqual(a2dPnt)) {
aCoincident = aConstrFeature;
break;
}
return;
AttributeRefAttrPtr aPnt = theStartCoin->refattr(theAttr);
- if (!aPnt)
+ if (!aPnt)
return;
ObjectPtr aObj = aPnt->object();
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
- if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
+ if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
if (!theCoincidencies.contains(aConstrFeature)) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincedencePoint(aConstrFeature);
if (aPnt.get() && aOrig->isEqual(aPnt)) {
- findCoincidences(aConstrFeature, theList, theCoincidencies,
+ findCoincidences(aConstrFeature, theList, theCoincidencies,
SketchPlugin_ConstraintCoincidence::ENTITY_A());
- findCoincidences(aConstrFeature, theList, theCoincidencies,
+ findCoincidences(aConstrFeature, theList, theCoincidencies,
SketchPlugin_ConstraintCoincidence::ENTITY_B());
}
}
ResultConstructionPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
if (aResult.get()) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aPnt->object());
- if (!theList.contains(aFeature))
+ if (!theList.contains(aFeature))
theList.append(aFeature);
theCoincidencies.append(theStartCoin);
for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
- if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
+ if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
if (!theCoincidencies.contains(aConstrFeature)) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincedencePoint(aConstrFeature);
if (aPnt.get() && aOrig->isEqual(aPnt)) {
- findCoincidences(aConstrFeature, theList, theCoincidencies,
+ findCoincidences(aConstrFeature, theList, theCoincidencies,
SketchPlugin_ConstraintCoincidence::ENTITY_A());
- findCoincidences(aConstrFeature, theList, theCoincidencies,
+ findCoincidences(aConstrFeature, theList, theCoincidencies,
SketchPlugin_ConstraintCoincidence::ENTITY_B());
}
}
std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin)
{
- std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
SketchPlugin_Constraint::ENTITY_A());
if (aPnt.get() == NULL)
aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B());
return aPnt;
}
-AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj,
- const TopoDS_Shape theShape,
+AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj,
+ const TopoDS_Shape theShape,
FeaturePtr theSketch)
{
new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
// find the given point in the feature attributes
- std::list<AttributePtr> anAttiributes =
+ std::list<AttributePtr> anAttiributes =
aFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::const_iterator anIt = anAttiributes.begin(),
+ std::list<AttributePtr>::const_iterator anIt = anAttiributes.begin(),
aLast = anAttiributes.end();
for (; anIt != aLast && !anAttribute; anIt++) {
- std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
if (!aCurPoint->isInitialized())
continue;
- std::shared_ptr<GeomAPI_Pnt> aPnt =
+ std::shared_ptr<GeomAPI_Pnt> aPnt =
convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch);
if (aPnt && (aPnt->distance(aValue) < Precision::Confusion())) {
anAttribute = aCurPoint;
/// \param theSketch the sketch feature
/// \param thePnt the 3D point in the viewer
/// \returns the converted point object
- static std::shared_ptr<GeomAPI_Pnt2d> convertTo2D(FeaturePtr theSketch,
+ static std::shared_ptr<GeomAPI_Pnt2d> convertTo2D(FeaturePtr theSketch,
const std::shared_ptr<GeomAPI_Pnt>& thePnt);
/// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point.
/// \param theX the X coordinate
/// \param theY the Y coordinate
/// \param theSketch the sketch feature
- static std::shared_ptr<GeomAPI_Pnt> convertTo3D(const double theX, const double theY,
+ static std::shared_ptr<GeomAPI_Pnt> convertTo3D(const double theX, const double theY,
FeaturePtr theSketch);
/// Returns pointer to the root document.
static std::shared_ptr<GeomDataAPI_Point2D> findFirstEqualPoint(const FeaturePtr& theFeature,
const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
- /// Creates constrains of the current
+ /// Creates constrains of the current
/// \param theSketch a sketch feature
/// \param theFeature a source feature
/// \param theAttribute a name of the requried attribute attribute
/// \return result of found feature or NULL
static std::shared_ptr<ModelAPI_Result> findFixedObjectByExternal(
const TopoDS_Shape& theShape,
- const ObjectPtr& theObject,
+ const ObjectPtr& theObject,
CompositeFeaturePtr theSketch);
/// Creates a line (arc or circle) by given edge
/// \param theTemporary the created external object is temporary, execute is not performed for it
/// \return result of created feature
static std::shared_ptr<ModelAPI_Result> createFixedObjectByExternal(
- const TopoDS_Shape& theShape,
- const ObjectPtr& theObject,
+ const TopoDS_Shape& theShape,
+ const ObjectPtr& theObject,
CompositeFeaturePtr theSketch,
const bool theTemporary = false);
/// \param theView a 3D view
/// \param theX the output horizontal coordinate of the point
/// \param theY the output vertical coordinate of the point
- static bool hasVertexShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
+ static bool hasVertexShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
FeaturePtr theSketch,
Handle_V3d_View theView, double& theX, double& theY);
ModuleBase_OperationFeature* aFeatureOp =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFeatureOp) {
- CompositeFeaturePtr aFeature =
+ CompositeFeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeatureOp->feature());
if (aFeature && (aFeature->getKind() == SketchPlugin_Sketch::ID()))
return PartSet_Tools::sketchPlane(aFeature);
}
}
- return aEmptyPln;
+ return aEmptyPln;
}
bool isEmptySelectionValid(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFeatureOp =
+ ModuleBase_OperationFeature* aFeatureOp =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
// during the create operation empty selection is always valid
if (!aFeatureOp->isEditOperation()) {
std::shared_ptr<GeomAPI_Pln> aPlane = sketcherPlane(theOperation);
if (aPlane.get())
return true;
- else
+ else
return false;
}
else
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
} else {
- QList<ModuleBase_ViewerPrsPtr> aList =
+ QList<ModuleBase_ViewerPrsPtr> aList =
theSelection->getSelected(ModuleBase_ISelection::Viewer);
int aCount = 0;
foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
} else {
- QList<ModuleBase_ViewerPrsPtr> aList =
+ QList<ModuleBase_ViewerPrsPtr> aList =
theSelection->getSelected(ModuleBase_ISelection::Viewer);
return (aList.count() == 1);
}
}
}
-bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
+bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return anError;
}
-bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute,
+bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- // the type of validated attributes should be equal, attributes with
+ // the type of validated attributes should be equal, attributes with
// different types are not validated
// Check RefAttr attributes
std::string anAttrType = theAttribute->attributeType();
std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs;
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr =
+ AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
bool isObject = anAttr->isObject();
ObjectPtr anObject = anAttr->object();
}
}
else if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr =
+ AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ResultPtr aContext = anAttr->context();
GeomShapePtr aShape = anAttr->value();
}
}
else if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr =
+ AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr anObject = anAttr->value();
// Check selection attributes
}
}
else if(anAttrType == ModelAPI_AttributeSelectionList::typeId()) {
- std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId());
if(anAttrs.size() > 0) {
std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrItr = anAttrs.begin();
for(; anAttrItr != anAttrs.end(); anAttrItr++){
if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()){
- std::shared_ptr<ModelAPI_AttributeSelectionList> aRefSelList =
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aRefSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*anAttrItr);
for(int i = 0; i < aCurSelList->size(); i++) {
std::shared_ptr<ModelAPI_AttributeSelection> aCurSel = aCurSelList->value(i);
for(int j = 0; j < aRefSelList->size(); j++) {
std::shared_ptr<ModelAPI_AttributeSelection> aRefSel = aRefSelList->value(j);
ResultPtr aRefSelContext = aRefSel->context();
- ResultCompSolidPtr aRefSelCompSolidPtr =
+ ResultCompSolidPtr aRefSelCompSolidPtr =
ModelAPI_Tools::compSolidOwner(aRefSelContext);
std::shared_ptr<GeomAPI_Shape> aRefSelCompSolid;
if(aRefSelCompSolidPtr.get()) {
return true;
}
-bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute,
+bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
ModuleBase_Operation* theOperation) const;
};
class PartSet_LengthSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
ModuleBase_Operation* theOperation) const;
};
class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
ModuleBase_Operation* theOperation) const;
};
private:
//! Returns error message for the error type
//! \param theType a type of error
- //! \param thEqualObjectInfo an
+ //! \param thEqualObjectInfo an
std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType,
const std::string& thEqualObject, const std::string& theFirstAttribute,
const std::string& theSecondAttribute) const;
/// Constructor
/// \param theParent the parent object
/// \param theData the widget configuation. The attribute of the model widget is obtained from
- PartSet_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData)
+ PartSet_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData)
: ModuleBase_WidgetChoice(theParent, theData) {}
};
DataPtr aData = myFeature->data();
AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
- mySelectedFilter =
+ mySelectedFilter =
formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
return ModuleBase_WidgetFileSelector::restoreValueCustom();
ModuleBase_WidgetMultiSelector::getGeomSelection(thePrs, theObject, theShape);
FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theObject);
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
// there is no a sketch feature is selected, but the shape exists, try to create an exernal object
// TODO: unite with the same functionality in PartSet_WidgetShapeSelector
aShape = aResult->shape();
}
if (aShape.get() != NULL && !aShape->isNull())
- anExternalObject =
+ anExternalObject =
myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
}
else {
/// Manager of external objects
PartSet_ExternalObjectsMgr* myExternalObjectMgr;
- /// Pointer to a sketch
+ /// Pointer to a sketch
CompositeFeaturePtr mySketch;
};
#include <QWidget>
-PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout(QWidget* theParent,
+PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData)
: PartSet_WidgetPoint2D(theParent, theWorkshop, theData)
/// Destructor
virtual ~PartSet_WidgetPoint2DFlyout() {};
- /// Checks if the selection presentation is valid in widget
+ /// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
static QStringList MyFeaturesForCoincedence;
-PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
+PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData)
: ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop),
bool aValid = true;
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- if (aModule->sketchReentranceMgr()->isInternalEditActive())
+ if (aModule->sketchReentranceMgr()->isInternalEditActive())
return true; /// when internal edit is started a new feature is created. I has not results, AIS
/// the selection is not possible if the current feature has no presentation for the current
myWorkshop->deactivateSubShapesSelection();
}
-bool PartSet_WidgetPoint2D::getPoint2d(const Handle(V3d_View)& theView,
- const TopoDS_Shape& theShape,
+bool PartSet_WidgetPoint2D::getPoint2d(const Handle(V3d_View)& theView,
+ const TopoDS_Shape& theShape,
double& theX, double& theY) const
{
if (!theShape.IsNull()) {
Handle(V3d_View) aView = theWindow->v3dView();
QList<ModuleBase_ViewerPrsPtr> aList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
- ModuleBase_ViewerPrsPtr aFirstValue =
+ ModuleBase_ViewerPrsPtr aFirstValue =
aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr();
if (!aFirstValue.get() && myPreSelected.get()) {
aFirstValue = myPreSelected;
isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
if (anExternal) {
// we should not stop reentrant operation on external objects because
- anOrphanPoint = true;
+ anOrphanPoint = true;
// they are not participate in the contour creation excepting external vertices
if (aShape.ShapeType() == TopAbs_VERTEX) {
FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject);
}
}
else {
- // point is taken from mouse event and set in attribute.
+ // point is taken from mouse event and set in attribute.
// It should be done before setting
- // coinident constraint to the external line. If a point is created, it should be
+ // coinident constraint to the external line. If a point is created, it should be
// in the mouse clicked point
gp_Pnt aPoint =
PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
}
if (aFixedObject.get())
setConstraintWith(aFixedObject);
- // fignal updated should be flushed in order to visualize possible created
+ // fignal updated should be flushed in order to visualize possible created
// external objects e.g. selection of trihedron axis when input end arc point
updateObject(feature());
}
else if (aShape.ShapeType() == TopAbs_EDGE) {
// point is taken from mouse event and set in attribute. It should be done before setting
- // coinident constraint to the external line. If a point is created, it should be in
+ // coinident constraint to the external line. If a point is created, it should be in
// the mouse clicked point
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, aY);
setValueState(Stored); // in case of edge selection, Apply state should also be updated
isAuxiliaryFeature = PartSet_Tools::isAuxiliarySketchEntity(aObject);
}
- // it is important to perform updateObject() in order to the current value is
+ // it is important to perform updateObject() in order to the current value is
// processed by Sketch Solver. Test case: line is created from a previous point
// to some distance, but in the area of the highlighting of the point. Constraint
// coincidence is created, after the solver is performed, the distance between the
//aIgnore.append(feature());
//double aTolerance = aView->Convert(7);
- //std::shared_ptr<GeomDataAPI_Point2D> aAttrPnt =
+ //std::shared_ptr<GeomDataAPI_Point2D> aAttrPnt =
// PartSet_Tools::findAttributePoint(mySketch, aX, anY, aTolerance, aIgnore);
//if (aAttrPnt.get() != NULL) {
// aFeaturePoint->setValue(aAttrPnt->pnt());
PartSet_Tools::convertTo2D(aPoint, mySketch, theWindow->v3dView(), aX, anY);
if (myState != ModifiedInViewer)
storeCurentValue();
- // we need to block the value state change
+ // we need to block the value state change
bool isBlocked = blockValueState(true);
setPoint(aX, anY);
blockValueState(isBlocked);
AttributePtr aWidgetAttribute = myFeature->attribute(attributeID());
- std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY));
std::list<AttributePtr> anAttributes =
myFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
/// Destructor
virtual ~PartSet_WidgetPoint2D();
- /// Checks if the selection presentation is valid in widget
+ /// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
/// Compute the feature default value and fill the controls with it
/// or store the control value to the feature
- /// The widget is not initialize the attribute value in order to avoid the
+ /// The widget is not initialize the attribute value in order to avoid the
/// incorrect visualization in Sketch. E.g. by a line creation, the line should not
/// be visualized immediatelly when the end point widget is activated.
virtual void initializeValueByActivate();
/// \param theShape a vertex shape
/// \param theX an output value of X coordinate
/// \param theY an output value of Y coordinate
- bool getPoint2d(const Handle(V3d_View)& theView, const TopoDS_Shape& theShape,
+ bool getPoint2d(const Handle(V3d_View)& theView, const TopoDS_Shape& theShape,
double& theX, double& theY) const;
/// Create a coincidence constraint between the attribute and the parameter object
AttributeDoublePtr aReal = aData->real(attributeID());
if (aReal && (aReal->value() != aValue)) {
aReal->setValue(aValue);
-
+
ModuleBase_Tools::setSpinValue(mySpinBox, aValue);
storeValue();
}
emit focusOutWidget(this);
}
-void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd,
+void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd,
QMouseEvent* theEvent)
{
if (isEditingMode())
virtual ~PartSet_WidgetPoint2dDistance();
- /// Checks if the selection presentation is valid in widget
+ /// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
/// \return true if the widget current value is reset
virtual bool resetCustom();
- /// Set the second point which defines a value in the widget as
+ /// Set the second point which defines a value in the widget as
/// a distance with a first point defined by feature
void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
protected:
/// A reference to workshop
ModuleBase_IWorkshop* myWorkshop;
-
+
/// A name of the first point
std::string myFirstPntName;
ModuleBase_WidgetShapeSelector::getGeomSelection(thePrs, theObject, theShape);
FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theObject);
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
- // there is no a sketch feature is selected, but the shape exists,
+ // there is no a sketch feature is selected, but the shape exists,
// try to create an exernal object
// TODO: unite with the same functionality in PartSet_WidgetShapeSelector
if (aSPFeature.get() == NULL) {
aShape = aResult->shape();
}
if (aShape.get() != NULL && !aShape->isNull())
- anExternalObject =
+ anExternalObject =
myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
}
else { /// use objects of found selection
/// A reference to external objects manager
PartSet_ExternalObjectsMgr* myExternalObjectMgr;
- /// Pointer to a sketch
+ /// Pointer to a sketch
CompositeFeaturePtr mySketch;
bool myUseSketchPlane; ///< state whether the sketch plane filter should be switched on
#define DEBUG_UNDO_INVALID_SKETCH
-PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
+PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
PartSet_Module* theModule,
const Config_WidgetAPI* theData)
: ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData),
bool aDone = false;
if (!startSketchOperation(theValues)) {
myIsCustomAttribute = true;
- QList<ModuleBase_ViewerPrsPtr>::const_iterator
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator
anIt = theValues.begin(), aLast = theValues.end();
bool aProcessed = false;
for (; anIt != aLast; anIt++) {
emit valuesChanged();
updateObject(myFeature);
setVisibleSelectionControl(false);
- // manually deactivation because the widget was
+ // manually deactivation because the widget was
// not activated as has no focus acceptin controls
deactivate();
emit focusOutWidget(this);
/// sketch should not started by object(face) selected as global. If Local face is selected,
/// sketch is started
if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) {
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (!aConstruction.get() || !aConstruction->isInfinite())
return aSketchStarted;
myPreviewPlanes->erasePreviewPlanes(myWorkshop);
// Launch Sketch operation
- CompositeFeaturePtr aCompFeature =
+ CompositeFeaturePtr aCompFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
// start edit operation for the sketch
return true;
}
else
- connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)),
+ connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)),
SLOT(onResumed(ModuleBase_Operation*)));
return true;
// Validate the created sketch. If it is valid, it is set into the composite feature selection
// list, otherwise it is removed
- CompositeFeaturePtr aCompFeature =
+ CompositeFeaturePtr aCompFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
if (aCompFeature->numberOfSubs() > 0) {
aMgr->startOperation("Delete invalid Sketch feature", false);
// delete invalid sketch
- CompositeFeaturePtr aSketchFeature =
+ CompositeFeaturePtr aSketchFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
QObjectPtrList anObjects;
anObjects.append(aSketchFeature);
}
// Hide sketcher result
- CompositeFeaturePtr aSketchFeature =
+ CompositeFeaturePtr aSketchFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
std::list<ResultPtr> aResults = aSketchFeature->results();
std::list<ResultPtr>::const_iterator aIt;
}
ResultPtr aSketchRes = aSketchFeature->results().front();
- ResultConstructionPtr aConstruction =
+ ResultConstructionPtr aConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSketchRes);
if(!aConstruction.get()) {
return;
/// \return a control list
virtual QList<QWidget*> getControls() const;
- /// Set focus to the first control of the current widget.
+ /// Set focus to the first control of the current widget.
/// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
aViewLayout->addWidget(myViewInverted);
- QPushButton* aSetViewBtn =
+ QPushButton* aSetViewBtn =
new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView()));
aViewLayout->addWidget(aSetViewBtn);
//myLabel->setText("");
//myLabel->setToolTip("");
XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
- disconnect(aWorkshop->selector(), SIGNAL(selectionChanged()),
+ disconnect(aWorkshop->selector(), SIGNAL(selectionChanged()),
this, SLOT(onSelectionChanged()));
// 4. deactivate face selection filter
activateFilters(false);
if (thePrs->object() && (theFeature != thePrs->object())) {
DataPtr aData = theFeature->data();
- AttributeSelectionPtr aSelAttr =
+ AttributeSelectionPtr aSelAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
if (aSelAttr) {
FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject);
std::list<AttributePtr> a2DPointAttributes = aBaseFeature->data()->attributes(
GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::const_iterator anIt = a2DPointAttributes.begin(),
+ std::list<AttributePtr>::const_iterator anIt = a2DPointAttributes.begin(),
aLast = a2DPointAttributes.end();
for (; anIt != aLast; anIt++) {
- std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
+ std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
std::shared_ptr<GeomAPI_Pnt2d> aPoint2D = anAttributePoint->pnt();
std::shared_ptr<GeomAPI_Pnt> aPoint3D = PartSet_Tools::convertTo3D(aPoint2D->x(),
/// find the points in coincident features
PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject];
- PntToAttributesMap::const_iterator
+ PntToAttributesMap::const_iterator
aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
for (; aRIt != aRLast; aRIt++) {
std::shared_ptr<GeomDataAPI_Point2D> anAttribute = aRIt->first;
std::shared_ptr<GeomAPI_Pnt> > PntToAttributesMap;
std::map<ObjectPtr, PntToAttributesMap> myCashedReferences;
- /// Pointer to a sketch
+ /// Pointer to a sketch
CompositeFeaturePtr mySketch;
};
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : PartSetAPI_Part.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : PartSetAPI_Part.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
class PartSetPlugin_Duplicate : public ModelAPI_Feature
{
public:
-
+
/// Duplicate kind
inline static const std::string& ID()
{
aRoot->refsToFeature(aFeature, aRefFeatures);
if (aRefFeatures.empty()) {
aRoot->removeFeature(aFeature);
- // the redisplay signal should be flushed in order to erase the feature presentation
+ // the redisplay signal should be flushed in order to erase the feature presentation
// in the viewer after removeFeature from the document
Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
/// Constructor without values.
PRIMITIVESAPI_EXPORT
explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature);
-
+
/// Constructor with values.
PRIMITIVESAPI_EXPORT
explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Double& theDx,
const ModelHighAPI_Double& theDy,
const ModelHighAPI_Double& theDz);
-
+
/// Constructor with values.
PRIMITIVESAPI_EXPORT
explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theFirstPoint,
const ModelHighAPI_Selection& theSecondPoint);
-
+
/// Destructor.
PRIMITIVESAPI_EXPORT
virtual ~PrimitivesAPI_Box();
-
- INTERFACE_6(PrimitivesPlugin_Box::ID(),
+
+ INTERFACE_6(PrimitivesPlugin_Box::ID(),
creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(),
ModelAPI_AttributeString, /** Creation method */,
dx, PrimitivesPlugin_Box::DX_ID(),
ModelAPI_AttributeDouble, /** Dimension in Y */,
dz, PrimitivesPlugin_Box::DZ_ID(),
ModelAPI_AttributeDouble, /** Dimension in Z */,
- firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(),
+ firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(),
ModelAPI_AttributeSelection, /** First point */,
- secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(),
+ secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(),
ModelAPI_AttributeSelection, /** Second point */)
-
+
/// Set dimensions
PRIMITIVESAPI_EXPORT
void setDimensions(const ModelHighAPI_Double& theDx,
const ModelHighAPI_Double& theDy,
const ModelHighAPI_Double& theDz);
-
+
/// Set points
PRIMITIVESAPI_EXPORT
void setPoints(const ModelHighAPI_Selection& theFirstPoint,
#define PrimitivesAPI_swig_H_
#include <ModelHighAPI_swig.h>
-
+
#include "PrimitivesAPI_Box.h"
data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(),
+ data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(),
ModelAPI_AttributeSelection::typeId());
data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND_ID(),
ModelAPI_AttributeSelection::typeId());
{
AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Box::CREATION_METHOD());
std::string aMethodType = aMethodTypeAttr->value();
-
- if (aMethodType == CREATION_METHOD_BY_DIMENSIONS())
+
+ if (aMethodType == CREATION_METHOD_BY_DIMENSIONS())
createBoxByDimensions();
-
- if (aMethodType == CREATION_METHOD_BY_TWO_POINTS())
+
+ if (aMethodType == CREATION_METHOD_BY_TWO_POINTS())
createBoxByTwoPoints();
}
double aDz = real(PrimitivesPlugin_Box::DZ_ID())->value();
std::shared_ptr<GeomAlgoAPI_Box> aBoxAlgo(new GeomAlgoAPI_Box(aDx,aDy,aDz));
-
- // These checks should be made to the GUI for the feature but
+
+ // These checks should be made to the GUI for the feature but
// the corresponding validator does not exist yet.
if (!aBoxAlgo->check()) {
// The error is not displayed in a popup window. It must be in the status bar.
setError(aBoxAlgo->getError(), false);
return;
}
-
- // Build the box
+
+ // Build the box
aBoxAlgo->build();
// Check if the creation of the box
setError(aBoxAlgo->getError());
return;
}
-
+
int aResultIndex = 0;
- ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
+ ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
loadNamingDS(aBoxAlgo, aResultBox);
setResult(aResultBox, aResultIndex);
}
//=================================================================================================
-void PrimitivesPlugin_Box::createBoxByTwoPoints()
+void PrimitivesPlugin_Box::createBoxByTwoPoints()
{
AttributeSelectionPtr aRef1 = data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID());
AttributeSelectionPtr aRef2 = data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID());
-
+
std::shared_ptr<GeomAlgoAPI_BoxPoints> aBoxAlgo;
-
+
if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) {
GeomShapePtr aShape1 = aRef1->value();
if (!aShape1.get()) //If we can't get the points directly, try getting them from the context
new GeomAlgoAPI_BoxPoints(aFirstPoint,aSecondPoint));
}
}
-
- // These checks should be made to the GUI for the feature but
+
+ // These checks should be made to the GUI for the feature but
// the corresponding validator does not exist yet.
if (!aBoxAlgo->check()) {
// The error is not displayed in a popup window. It must be in the message console.
setError(aBoxAlgo->getError(), false);
return;
}
-
- // Build the box
+
+ // Build the box
aBoxAlgo->build();
// Check if the creation of the box
setError(aBoxAlgo->getError(), false);
return;
}
-
+
int aResultIndex = 0;
- ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
+ ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
loadNamingDS(aBoxAlgo, aResultBox);
setResult(aResultBox, aResultIndex);
}
{
// Load the result
theResultBox->store(theBoxAlgo->shape());
-
+
// Prepare the naming
theBoxAlgo->prepareNamingFaces();
-
+
// Insert to faces
int num = 1;
- std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theBoxAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
theResultBox->generated(aFace, (*it).first, num++);
static const std::string MY_CREATION_METHOD_ID("CreationMethod");
return MY_CREATION_METHOD_ID;
}
-
+
/// Attribute name for creation method
inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
{
static const std::string MY_CREATION_METHOD_ID("BoxByDimensions");
return MY_CREATION_METHOD_ID;
}
-
+
/// Attribute name for creation method
inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
{
/// Request for initialization of data model of the feature: adding all attributes
PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
-
+
/// Use plugin manager for features creation
PrimitivesPlugin_Box();
///Perform the creation of the box using two points defining a diagonal
void createBoxByTwoPoints();
-
+
///Perform the creation of the box using three cordinates
void createBoxByDimensions();
SHAPERGUI_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):
myMgr(theMgr), myModName(theModName) {}
- virtual int addPreference(const QString& theLbl, int pId,
+ virtual int addPreference(const QString& theLbl, int pId,
SUIT_PreferenceMgr::PrefItemType theType,
const QString& theSection, const QString& theName )
{
void SHAPERGUI::connectToStudy(CAM_Study* theStudy)
{
// if there are created viewer managers, we should try to create viewer
- // selector and initialize viewer with it. It sets interactive contect to the
+ // selector and initialize viewer with it. It sets interactive contect to the
// proxy viewer. If study is opened, CAM application calls this method before the open()
// of data model
// the SHAPER data model is specific and during open(load) redisplay signals are flushed, so
mySelector = createSelector(OCCViewManagers.first());
}
}
- // it should be pefromed after the selector creation in order to have AISContext
+ // it should be pefromed after the selector creation in order to have AISContext
myWorkshop->activateModule();
//action(myEraseAll)->setEnabled(false);
theInfo.id,
theInfo.text,
//Issue #650: in the SALOME mode the tooltip should be same as text
- theInfo.text,
+ theInfo.text,
theInfo.icon,
theInfo.shortcut,
theInfo.checkable,
// Create other parameters group in viewer tab
int otherGroup = pref->addItem(tr("Default selection"), viewTab);
pref->setItemProperty("columns", 3, otherGroup);
- pref->addItem(tr("Faces"), otherGroup,
+ pref->addItem(tr("Faces"), otherGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
- pref->addItem(tr("Edges"), otherGroup,
+ pref->addItem(tr("Edges"), otherGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
- pref->addItem(tr("Vertices"), otherGroup,
+ pref->addItem(tr("Vertices"), otherGroup,
SUIT_PreferenceMgr::Bool,
ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
-
+
int sensitivityGroup = pref->addItem(tr("Selection sensitivity"), viewTab);
pref->setItemProperty("columns", 2, sensitivityGroup);
pref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::Double,
/// \brief Definition of module standard windows
virtual void windows(QMap<int, int>& theWndMap) const;
- /// \brief Definition of module viewer
+ /// \brief Definition of module viewer
virtual void viewManagers(QStringList& theList) const;
/// \brief The method is called on selection changed event
//! Returns list of defined actions (just by SHAPER module)
virtual QList<QAction*> commandList() const;
- /// Redefinition of virtual function.
+ /// Redefinition of virtual function.
/// \param theClient name of pop-up client
/// \param theMenu popup menu instance
/// \param theTitle menu title.
virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
- /// Redefinition of virtual function for preferences creation.
+ /// Redefinition of virtual function for preferences creation.
virtual void createPreferences();
- /// Redefinition of virtual function for preferences changed event.
+ /// Redefinition of virtual function for preferences changed event.
virtual void preferencesChanged(const QString& theSection, const QString& theParam);
//! Shows the given text in status bar as a permanent text
// the next parameters should be restored after this module deactivation
/// The application value of the preferences parameter
- bool myIsStorePositions;
+ bool myIsStorePositions;
/// The application value
- bool myIsEditEnabled;
+ bool myIsEditEnabled;
/// Popup manager
QtxPopupMgr* myPopupMgr;
Qtx::rmDir(theDirectoryName);
}
-bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy,
+bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy,
bool isMultiFile, QStringList& theListOfFiles)
{
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(theStudy);
}
AttributeStringPtr aAttr = aFeature->string(ExchangePlugin_Dump::FILE_PATH_ID());
- if (aAttr.get())
+ if (aAttr.get())
aAttr->setValue(aFileName);
aAttr = aFeature->string(ExchangePlugin_Dump::FILE_FORMAT_ID());
- if (aAttr.get())
+ if (aAttr.get())
aAttr->setValue(".py");
ModelAPI_Session::get()->finishOperation();
if (QFile::exists(aFileName.c_str())) {
- if (isMultiFile) {
+ if (isMultiFile) {
QFile aInFile(aFileName.c_str());
if (!aInFile.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
QString myStudyPath;
/// a path to the temporary directory, created by opening a document file
- QString myTmpDirectory;
+ QString myTmpDirectory;
/// it should be created because the files reading is postponed in the module. The directory
// should be removed after the model document is closed.
} else {
QString s = "false";
}
-
+
}
/// Creates the button representation
/// \param theParent a parent widget
virtual QWidget * createWidget(QWidget * theParent);
-
+
virtual bool event(QEvent* theEvent);
private:
// TODO: Provide ModuleBase_IViewWindow interface
connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager*)), this, SIGNAL(lastViewClosed()));
- connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewWindow*)),
+ connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewWindow*)),
this, SLOT(onTryCloseView(SUIT_ViewWindow*)));
- connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow*)),
+ connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow*)),
this, SLOT(onDeleteView(SUIT_ViewWindow*)));
- connect(aMgr, SIGNAL(viewCreated(SUIT_ViewWindow*)),
+ connect(aMgr, SIGNAL(viewCreated(SUIT_ViewWindow*)),
this, SLOT(onViewCreated(SUIT_ViewWindow*)));
- connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)),
+ connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)),
this, SLOT(onActivated(SUIT_ViewManager*)));
connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this,
}
reconnectActions(aWnd, true);
- myWindowScale.insert(aView->getViewPort()->getView(),
+ myWindowScale.insert(aView->getViewPort()->getView(),
aView->getViewPort()->getView()->Camera()->Scale());
emit viewCreated(myView);
}
//**********************************************
-void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY,
+void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY,
double theZ, double theTwist)
{
- if (!mySelector)
+ if (!mySelector)
return;
SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
foreach (SUIT_ViewWindow* aView, aViews) {
OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
- disconnect((OCCViewer_ViewWindow*)aWnd,
+ disconnect((OCCViewer_ViewWindow*)aWnd,
SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
reconnectActions(aWnd, false);
/// Update current viewer
virtual void update();
- /// Method returns True if the viewer can process editing objects
+ /// Method returns True if the viewer can process editing objects
/// by mouse drugging. If this is impossible thet it has to return False.
virtual bool canDragByMouse() const;
void onSelectionChanged();
void onViewTransformed(OCCViewer_ViewWindow::OperationType);
- /// Emit signal about trihedron visiblity change because SALOME sets
+ /// Emit signal about trihedron visiblity change because SALOME sets
/// the trihedron visible by this signal.
/// It is necessary to activate the viewer trihedron in the current selection mode
void onViewPortMapped();
: SketchAPI_SketchEntity(theFeature)
{
if(initialize()) {
- setByCenterStartEnd(theCenterX, theCenterY, theStartX,
+ setByCenterStartEnd(theCenterX, theCenterY, theStartX,
theStartY, theEndX, theEndY, theInversed);
}
}
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Constraint.cpp
-// Purpose:
+// Purpose:
//
// History:
// 08/08/16 - Artem ZHIDKOV - Creation of the file
FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
if (!aFeature)
return;
- AttributeSelectionPtr aAttr =
+ AttributeSelectionPtr aAttr =
aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
if (aAttr && aAttr->context().get() != NULL && !aAttr->isInvalid())
return;
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Constraint.h
-// Purpose:
+// Purpose:
//
// History:
// 08/08/16 - Artem ZHIDKOV - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_IntersectionPoint.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
const std::string& aSketchName = theDumper.parentName(aBase);
AttributeSelectionPtr aLine = externalLine();
- theDumper << aBase << " = " <<
+ theDumper << aBase << " = " <<
aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl;
// dump "auxiliary" flag if necessary
SketchAPI_SketchEntity::dump(theDumper);
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_IntersectionPoint.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~SketchAPI_IntersectionPoint();
INTERFACE_2(SketchPlugin_IntersectionPoint::ID(),
- coordinates, SketchPlugin_IntersectionPoint::COORD_ID(),
+ coordinates, SketchPlugin_IntersectionPoint::COORD_ID(),
GeomDataAPI_Point2D, /** IntersectionPoint coordinates */,
- externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(),
+ externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(),
ModelAPI_AttributeSelection, /** External line */
)
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Line.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Line.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~SketchAPI_Line();
INTERFACE_3(SketchPlugin_Line::ID(),
- startPoint, SketchPlugin_Line::START_ID(),
+ startPoint, SketchPlugin_Line::START_ID(),
GeomDataAPI_Point2D, /** Start point */,
endPoint, SketchPlugin_Line::END_ID(),
GeomDataAPI_Point2D, /** End point */,
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Mirror.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Mirror.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~SketchAPI_Mirror();
INTERFACE_4(SketchPlugin_ConstraintMirror::ID(),
- mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(),
+ mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(),
ModelAPI_AttributeRefAttr, /** Mirror line */,
- mirrorList, SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(),
+ mirrorList, SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(),
ModelAPI_AttributeRefList, /** Mirror list */,
- referenceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(),
+ referenceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(),
ModelAPI_AttributeRefList, /** Reference objects */,
- mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(),
+ mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(),
ModelAPI_AttributeRefList, /** Mirrored objects */
)
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Point.cpp
-// Purpose:
+// Purpose:
//
// History:
// 15/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Point.h
-// Purpose:
+// Purpose:
//
// History:
// 15/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Projection.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Projection.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
virtual ~SketchAPI_Projection();
INTERFACE_3(SketchPlugin_Projection::ID(),
- externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(),
+ externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(),
ModelAPI_AttributeSelection, /** External feature */,
- projectedFeature, SketchPlugin_Projection::PROJECTED_FEATURE_ID(),
+ projectedFeature, SketchPlugin_Projection::PROJECTED_FEATURE_ID(),
ModelAPI_AttributeRefAttr, /** Projected feature */,
- external, SketchPlugin_Projection::EXTERNAL_ID(),
+ external, SketchPlugin_Projection::EXTERNAL_ID(),
ModelAPI_AttributeSelection, /** External */
)
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Rectangle.cpp
-// Purpose:
+// Purpose:
//
// History:
// 17/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Rectangle.h
-// Purpose:
+// Purpose:
//
// History:
// 17/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Rotation.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Rotation.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
ModelAPI_AttributeDouble, /** Angle */,
numberOfObjects, SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(),
ModelAPI_AttributeInteger, /** Number of objects */,
- valueType, SketchPlugin_MultiRotation::ANGLE_TYPE(),
+ valueType, SketchPlugin_MultiRotation::ANGLE_TYPE(),
ModelAPI_AttributeString, /** Value type */,
- referenceObjects, SketchPlugin_MultiRotation::ENTITY_A(),
+ referenceObjects, SketchPlugin_MultiRotation::ENTITY_A(),
ModelAPI_AttributeRefList, /** Reference objects */,
- rotatedObjects, SketchPlugin_MultiRotation::ENTITY_B(),
+ rotatedObjects, SketchPlugin_MultiRotation::ENTITY_B(),
ModelAPI_AttributeRefList, /** Rotated objects */
)
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Sketch.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
double theX, double theY)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Point::ID());
return PointPtr(new SketchAPI_Point(aFeature, theX, theY));
}
std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Point::ID());
return PointPtr(new SketchAPI_Point(aFeature, thePoint));
}
-std::shared_ptr<SketchAPI_Point>
+std::shared_ptr<SketchAPI_Point>
SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Point::ID());
return PointPtr(new SketchAPI_Point(aFeature, theExternal));
}
std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::string & theExternalName)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Point::ID());
return PointPtr(new SketchAPI_Point(aFeature, theExternalName));
}
std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
const ModelHighAPI_Selection & theExternal)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternal));
}
std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
const std::string & theExternalName)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternalName));
}
//--------------------------------------------------------------------------------------
-std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(double theX1, double theY1,
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(double theX1, double theY1,
double theX2, double theY2)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Line::ID());
return LinePtr(new SketchAPI_Line(aFeature, theX1, theY1, theX2, theY2));
}
const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Line::ID());
return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint));
}
-std::shared_ptr<SketchAPI_Line>
+std::shared_ptr<SketchAPI_Line>
SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Line::ID());
return LinePtr(new SketchAPI_Line(aFeature, theExternal));
}
std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Line::ID());
return LinePtr(new SketchAPI_Line(aFeature, theExternalName));
}
//--------------------------------------------------------------------------------------
-std::shared_ptr<SketchAPI_Rectangle> SketchAPI_Sketch::addRectangle(double theX1, double theY1,
+std::shared_ptr<SketchAPI_Rectangle> SketchAPI_Sketch::addRectangle(double theX1, double theY1,
double theX2, double theY2)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchAPI_Rectangle::ID());
return RectanglePtr(new SketchAPI_Rectangle(aFeature, theX1, theY1, theX2, theY2));
}
const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchAPI_Rectangle::ID());
return RectanglePtr(new SketchAPI_Rectangle(aFeature, theStartPoint, theEndPoint));
}
double theCenterY,
double theRadius)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius));
}
const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
double theRadius)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius));
}
double theX2, double theY2,
double theX3, double theY3)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, theX1, theY1, theX2, theY2, theX3, theY3));
}
const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3));
}
-std::shared_ptr<SketchAPI_Circle>
+std::shared_ptr<SketchAPI_Circle>
SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
}
std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::string & theExternalName)
{
// TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Circle::ID());
return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
}
double theEndX, double theEndY,
bool theInversed)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature,
theCenterX, theCenterY,
const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
bool theInversed)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed));
}
double theEndX, double theEndY,
double thePassedX, double thePassedY)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature,
theStartX, theStartY,
const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed));
}
double theEndX, double theEndY,
bool theInversed)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
}
const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
bool theInversed)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed));
}
std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
}
std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
{
// TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Arc::ID());
return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
}
std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
const ModelHighAPI_Selection & theExternalFeature)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Projection::ID());
return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature));
}
std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
const std::string & theExternalName)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_Projection::ID());
return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalName));
}
const ModelHighAPI_RefAttr & theMirrorLine,
const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID());
return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects));
}
const ModelHighAPI_Integer & theNumberOfObjects,
bool theFullValue)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID());
- return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1,
+ return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1,
thePoint2, theNumberOfObjects, theFullValue));
}
const ModelHighAPI_Integer & theNumberOfObjects,
bool theFullValue)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID());
return RotationPtr(
- new SketchAPI_Rotation(aFeature, theObjects, theCenter,
+ new SketchAPI_Rotation(aFeature, theObjects, theCenter,
theAngle, theNumberOfObjects, theFullValue));
}
const ModelHighAPI_RefAttr& thePoint1,
const ModelHighAPI_RefAttr& thePoint2)
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ std::shared_ptr<ModelAPI_Feature> aFeature =
compositeFeature()->addFeature(SketchPlugin_ConstraintSplit::ID());
fillAttribute(theFeature, aFeature->reference(SketchPlugin_Constraint::VALUE()));
fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
theDumper << aBase << " = model.addSketch(" << aDocName
<< ", model.standardPlane(\"" << aPlaneName << "\"))" << std::endl;
} else { // some other plane
- theDumper << aBase << " = model.addSketch(" << aDocName <<
+ theDumper << aBase << " = model.addSketch(" << aDocName <<
", " << anExternal<< ")" << std::endl;
}
} else {
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Sketch.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
GeomDataAPI_Dir, /** Direction of X */,
normal, SketchPlugin_Sketch::NORM_ID(),
GeomDataAPI_Dir, /** Normal */,
- features, SketchPlugin_Sketch::FEATURES_ID(),
+ features, SketchPlugin_Sketch::FEATURES_ID(),
ModelAPI_AttributeRefList, /** Features */,
- external, SketchPlugin_SketchEntity::EXTERNAL_ID(),
+ external, SketchPlugin_SketchEntity::EXTERNAL_ID(),
ModelAPI_AttributeSelection, /** External */,
solverError, SketchPlugin_Sketch::SOLVER_ERROR(),
ModelAPI_AttributeString, /** Solver error */,
/// Add intersection point
SKETCHAPI_EXPORT
- std::shared_ptr<SketchAPI_IntersectionPoint>
+ std::shared_ptr<SketchAPI_IntersectionPoint>
addIntersectionPoint(const ModelHighAPI_Selection & theExternal);
/// Add point
SKETCHAPI_EXPORT
- std::shared_ptr<SketchAPI_IntersectionPoint>
+ std::shared_ptr<SketchAPI_IntersectionPoint>
addIntersectionPoint(const std::string & theExternalName);
/// Add line
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_SketchEntity.cpp
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_SketchEntity.h
-// Purpose:
+// Purpose:
//
// History:
// 07/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Translation.cpp
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : SketchAPI_Translation.h
-// Purpose:
+// Purpose:
//
// History:
// 16/06/16 - Sergey POKHODENKO - Creation of the file
std::shared_ptr<GeomAPI_Shape> aCircleShape;
if(!isInversed->value()) {
- aCircleShape =
+ aCircleShape =
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
} else {
- aCircleShape =
+ aCircleShape =
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal);
}
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
- std::shared_ptr<GeomAPI_Pnt>
+ std::shared_ptr<GeomAPI_Pnt>
aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
std::shared_ptr<GeomAPI_Pnt> aEndPoint = aStartPoint;
if (aTypeAttr && aTypeAttr->isInitialized() &&
aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
- if (aEndAttr->isInitialized() && //
+ if (aEndAttr->isInitialized() && //
aEndAttr->pnt()->distance(aStartAttr->pnt()) > tolerance) {
aEndPoint = aSketch->to3D(aEndAttr->x(), aEndAttr->y());
- std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
data()->attribute(PASSED_POINT_ID()));
if (!aPassedAttr->isInitialized()) {
// check that center is bad for the current start and end and must be recomputed
std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(
aCenterAttr->pnt(), aStartAttr->pnt()));
- std::shared_ptr<GeomAPI_Pnt2d> aProjection =
+ std::shared_ptr<GeomAPI_Pnt2d> aProjection =
aCircleForArc->project(aEndAttr->pnt());
if (!aProjection.get() || aEndAttr->pnt()->distance(aProjection) > tolerance) {
- std::shared_ptr<GeomAPI_XY> aDir =
+ std::shared_ptr<GeomAPI_XY> aDir =
aEndAttr->pnt()->xy()->decreased(aStartAttr->pnt()->xy())->multiplied(0.5);
double x = aDir->x();
double y = aDir->y();
AttributeBooleanPtr isInversed =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
- std::shared_ptr<GeomAPI_Shape> aCircleShape =
+ std::shared_ptr<GeomAPI_Shape> aCircleShape =
(isInversed->isInitialized() && isInversed->value()) ?
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal) :
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
}
}
// make a visible point
- std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
GeomAlgoAPI_PointBuilder::vertex(aCenter);
aShapes.push_back(aCenterPointShape);
}
bool isValid = false;
if (anArcType == ARC_TYPE_THREE_POINTS())
- isValid = aStartAttr->isInitialized() &&
+ isValid = aStartAttr->isInitialized() &&
anEndAttr->isInitialized() && aPassedAttr->isInitialized();
else
- isValid = aCenterAttr->isInitialized() &&
+ isValid = aCenterAttr->isInitialized() &&
aStartAttr->isInitialized() && anEndAttr->isInitialized();
return isValid;
std::dynamic_pointer_cast<ModelAPI_AttributeString>(attribute(ARC_TYPE()));
// this is before others since here end attribute may be changed, but with the special behavior
- if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
+ if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
(theID == TANGENT_POINT_ID() || theID == END_ID())) {
SketchPlugin_Sketch* aSketch = sketch();
AttributeRefAttrPtr aTangPtAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
std::shared_ptr<GeomAPI_Pnt2d> aMidPnt(
new GeomAPI_Pnt2d(aEndPntCoord->added(aTangPnt2d->xy())->multiplied(0.5)));
- // compute center of arc by calculating intersection of
+ // compute center of arc by calculating intersection of
// orthogonal line and middle perpendicular
std::shared_ptr<GeomAPI_Lin2d> anOrthoLine(new GeomAPI_Lin2d(aTangPnt2d, anOrthoDir));
std::shared_ptr<GeomAPI_Lin2d> aMiddleLine(new GeomAPI_Lin2d(aMidPnt, aMidDir));
}
}
// update all other attributes due to the base attributes values
- if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
+ if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
// update passed point due to start, end and center
if (aCenter->distance(aStart) > tolerance && aCenter->distance(anEnd) > tolerance) {
// project passed point t othe circle
std::shared_ptr<GeomAPI_Dir2d> aMidDir(new GeomAPI_Dir2d(aMidDirXY));
if ((aStartDir->cross(aMidDir) > 0) ^ !isReversed())
aMidDir->reverse();
- std::shared_ptr<GeomAPI_XY> aPassedPnt =
+ std::shared_ptr<GeomAPI_XY> aPassedPnt =
aCenter->xy()->added(aMidDir->xy()->multiplied(aCenter->distance(aStart)));
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()))->
setValue(aPassedPnt->x(), aPassedPnt->y());
adjustPeriod(aStartParam);
adjustPeriod(aEndParam);
// use the passed point for the angle calculation
- if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
+ if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
double aPassedParam;
}
if (theID == RADIUS_ID()) {
- if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
+ if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
!aCenterAttr->isInitialized())
return;
// move center and passed point
double aRadius = aRadiusAttr->value();
data()->blockSendAttributeUpdated(true);
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aStartDir(new GeomAPI_Dir2d(aStart->xy()->decreased(aCenter->xy())));
- std::shared_ptr<GeomAPI_XY>
+ std::shared_ptr<GeomAPI_XY>
aNewStart = aStartDir->xy()->multiplied(aRadius)->added(aCenter->xy());
aStartAttr->setValue(aNewStart->x(), aNewStart->y());
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
anEndDir(new GeomAPI_Dir2d(anEnd->xy()->decreased(aCenter->xy())));
- std::shared_ptr<GeomAPI_XY>
+ std::shared_ptr<GeomAPI_XY>
aNewEnd = anEndDir->xy()->multiplied(aRadius)->added(aCenter->xy());
anEndAttr->setValue(aNewEnd->x(), aNewEnd->y());
data()->blockSendAttributeUpdated(false);
*/
class SketchPlugin_Arc : public SketchPlugin_SketchEntity, public GeomAPI_IPresentable
{
- /// to avoid cyclic dependencies in automatic updates: they mean that
+ /// to avoid cyclic dependencies in automatic updates: they mean that
/// update is performed right now and automatic updates are not needed
bool myStartUpdate, myEndUpdate;
/// to avoid (if possible) additional modification of changed coordinate (issue #855)
// compute a circle point in 3D view
std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
- AttributeDoublePtr aRadiusAttr =
+ AttributeDoublePtr aRadiusAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(RADIUS_ID()));
if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
// compute a circle point in 3D view
std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
- AttributeDoublePtr aRadiusAttr =
+ AttributeDoublePtr aRadiusAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(attribute(RADIUS_ID()));
if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
if (aCircleShape && aRadius != 0) {
std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
// make a visible point
- std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
GeomAlgoAPI_PointBuilder::vertex(aCenter);
aShapes.push_back(aCenterPointShape);
aShapes.push_back(aCircleShape);
bool SketchPlugin_Circle::isFeatureValid()
{
- std::shared_ptr<GeomDataAPI_Point2D> aCenter =
+ std::shared_ptr<GeomDataAPI_Point2D> aCenter =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
bool aValid = aCenter->isInitialized();
if (aSelection && !aSelection->isNull() && aSelection->isEdge()) {
std::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
- std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
aCenterAttr->setValue(sketch()->to2D(aCirc->center()));
real(RADIUS_ID())->setValue(aCirc->radius());
std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
- AttributeDoublePtr aRadiusAttr =
+ AttributeDoublePtr aRadiusAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(RADIUS_ID()));
if (aNbInitialized == 1)
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
if (!aCenterAttr->isInitialized())
return;
- AttributeDoublePtr aRadiusAttr =
+ AttributeDoublePtr aRadiusAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(attribute(RADIUS_ID()));
if (!aRadiusAttr->isInitialized())
return;
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId());
- data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID(),
+ data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID(),
ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(SketchPlugin_ConstraintAngle::TYPE_ID(),
+ data()->addAttribute(SketchPlugin_ConstraintAngle::TYPE_ID(),
ModelAPI_AttributeInteger::typeId());
- data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID(),
+ data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID(),
ModelAPI_AttributeBoolean::typeId());
- data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID(),
+ data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID(),
ModelAPI_AttributeBoolean::typeId());
}
{
std::shared_ptr<ModelAPI_Data> aData = data();
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttrA =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttrA =
aData->refattr(SketchPlugin_Constraint::ENTITY_A());
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttrB =
aData->refattr(SketchPlugin_Constraint::ENTITY_B());
if (!anAttrA->isInitialized() || !anAttrB->isInitialized())
return;
anAttrValue->setValue(anAngle);
updateConstraintValueByAngleValue();
}
- // the value should to be computed here, not in the
+ // the value should to be computed here, not in the
// getAISObject in order to change the model value
// inside the object transaction. This is important for creating a constraint by preselection.
// The display of the presentation in this case happens after the transaction commit
if (!aLineA || !aLineB)
return;
- if (theID == SketchPlugin_Constraint::ENTITY_A() ||
+ if (theID == SketchPlugin_Constraint::ENTITY_A() ||
theID == SketchPlugin_Constraint::ENTITY_B()) {
AttributeDoublePtr aValueAttr = real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID());
AttributeDoublePtr aConstrValueAttr = real(SketchPlugin_Constraint::VALUE());
// only if one of attributes is not initialized, try to compute the current value
if (!aValueAttr->isInitialized() || !aConstrValueAttr->isInitialized()) {
- if (aValueAttr->isInitialized() && !aConstrValueAttr->isInitialized())
+ if (aValueAttr->isInitialized() && !aConstrValueAttr->isInitialized())
// initialize base value of constraint
updateConstraintValueByAngleValue();
double anAngle = calculateAngle();
std::shared_ptr<ModelAPI_Data> aData = data();
std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(sketch());
- FeaturePtr aLineA =
+ FeaturePtr aLineA =
SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
- FeaturePtr aLineB =
+ FeaturePtr aLineB =
SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
// Intersection of lines
anAngle = theAngle - 180.0;
else
anAngle = 180.0 - theAngle;
-
+
if (anAngle < 0.0)
anAngle += 360.0;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this,
+ AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this,
sketch()->coordinatePlane(),
thePrevious);
return anAIS;
void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID)
{
- if (theID == SketchPlugin_Constraint::ENTITY_A() ||
- theID == SketchPlugin_Constraint::ENTITY_B())
+ if (theID == SketchPlugin_Constraint::ENTITY_A() ||
+ theID == SketchPlugin_Constraint::ENTITY_B())
{
std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
- if (!aValueAttr->isInitialized()) {
+ if (!aValueAttr->isInitialized()) {
// only if it is not initialized, try to compute the current value
double aDistance = calculateCurrentDistance();
if (aDistance > 0) { // set as value the length of updated references
} else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) {
myFlyoutUpdate = true;
// Recalculate flyout point in local coordinates of the distance constraint:
- // the X coordinate is a length of projection of the flyout point on the
+ // the X coordinate is a length of projection of the flyout point on the
// line binding two distanced points
// or a line of projection of the distanced point onto the distanced segment
// the Y coordinate is a distance from the flyout point to the line
void SketchPlugin_ConstraintFillet::initAttributes()
{
data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
+ data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
ModelAPI_AttributeRefAttrList::typeId());
}
aPointsIter != myNewPoints.end();
++aPointsIter) {
AttributePtr aPointAttr = *aPointsIter;
- std::shared_ptr<GeomDataAPI_Point2D> aFilletPoint2d =
+ std::shared_ptr<GeomDataAPI_Point2D> aFilletPoint2d =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aPointAttr);
if(!aFilletPoint2d.get()) {
setError("Error: One of the selected points is empty.");
// Obtain base lines for fillet.
bool anIsNeedNewObjects = true;
FilletFeatures aFilletFeatures;
- std::map<AttributePtr, FilletFeatures>::iterator aPrevPointsIter =
+ std::map<AttributePtr, FilletFeatures>::iterator aPrevPointsIter =
myPointFeaturesMap.find(aPointAttr);
if(aPrevPointsIter != myPointFeaturesMap.end()) {
anIsNeedNewObjects = false;
// Obtain constraint coincidence for the fillet point.
FeaturePtr aConstraintCoincidence;
const std::set<AttributePtr>& aRefsList = aFilletPoint2d->owner()->data()->refsToMe();
- for(std::set<AttributePtr>::const_iterator
+ for(std::set<AttributePtr>::const_iterator
anIt = aRefsList.cbegin(); anIt != aRefsList.cend(); ++anIt) {
std::shared_ptr<ModelAPI_Attribute> anAttr = (*anIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->owner());
aBaseEdgeA = *aLinesIt++;
aBaseEdgeB = *aLinesIt;
- std::pair<FeaturePtr, bool> aBasePairA =
- std::make_pair(aBaseEdgeA,
+ std::pair<FeaturePtr, bool> aBasePairA =
+ std::make_pair(aBaseEdgeA,
aBaseEdgeA->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value());
- std::pair<FeaturePtr, bool> aBasePairB =
- std::make_pair(aBaseEdgeB,
+ std::pair<FeaturePtr, bool> aBasePairB =
+ std::make_pair(aBaseEdgeB,
aBaseEdgeB->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value());
aFilletFeatures.baseEdgesState.push_back(aBasePairA);
aFilletFeatures.baseEdgesState.push_back(aBasePairB);
FeaturePtr aBaseFeatures[aNbFeatures] = {aBaseEdgeA, aBaseEdgeB};
FeaturePtr aResultFeatures[aNbFeatures] = {aResultEdgeA, aResultEdgeB};
// tangent directions of the features in coincident point
- std::shared_ptr<GeomAPI_Dir2d> aTangentDir[aNbFeatures];
+ std::shared_ptr<GeomAPI_Dir2d> aTangentDir[aNbFeatures];
bool isStart[aNbFeatures]; // indicates which point the features share
// first pair of points relate to first feature, second pair - to second
- std::shared_ptr<GeomAPI_Pnt2d> aStartEndPnt[aNbFeatures * 2];
+ std::shared_ptr<GeomAPI_Pnt2d> aStartEndPnt[aNbFeatures * 2];
std::string aFeatAttributes[aNbFeatures * 2]; // attributes of features
for (int i = 0; i < aNbFeatures; i++) {
std::string aStartAttr, aEndAttr;
if (!isStart[i])
aDir = aDir->multiplied(-1.0);
} else if (aResultFeatures[i]->getKind() == SketchPlugin_Arc::ID()) {
- std::shared_ptr<GeomAPI_Pnt2d> aCenterPoint =
+ std::shared_ptr<GeomAPI_Pnt2d> aCenterPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aResultFeatures[i]->attribute(SketchPlugin_Arc::CENTER_ID()))->pnt();
aDir = isStart[i] ? aStartEndPnt[2*i]->xy() : aStartEndPnt[2*i+1]->xy();
double y = aDir->y();
aDir->setX(-y);
aDir->setY(x);
- if (isStart[i] ==
+ if (isStart[i] ==
std::dynamic_pointer_cast<SketchPlugin_Arc>(aBaseFeatures[i])->isReversed())
aDir = aDir->multiplied(-1.0);
}
// By default, the start point of fillet arc is connected to FeatureA,
// and the end point - to FeatureB. But when the angle between TangentDirA and
// TangentDirB greater 180 degree, the sequaence of features need to be reversed.
- double cosBA = aTangentDir[0]->cross(aTangentDir[1]); // cos(B-A),
+ double cosBA = aTangentDir[0]->cross(aTangentDir[1]); // cos(B-A),
// where A and B - angles between corresponding tanget direction and the X axis
bool isReversed = cosBA > 0.0;
// Calculate fillet arc parameters
std::shared_ptr<GeomAPI_XY> aCenter, aTangentPntA, aTangentPntB;
- calculateFilletCenter(aBaseEdgeA, aBaseEdgeB, aFilletRadius,
+ calculateFilletCenter(aBaseEdgeA, aBaseEdgeB, aFilletRadius,
isStart, aCenter, aTangentPntA, aTangentPntB);
if(!aCenter.get() || !aTangentPntA.get() || !aTangentPntB.get()) {
setError("Can not create fillet with the specified parameters.");
aResultEdgeB->attribute(aFeatAttributes[2 + (isStart[1] ? 0 : 1)]))->
setValue(aTangentPntB->x(), aTangentPntB->y());
aResultEdgeB->execute();
- // update fillet arc: make the arc correct for sure, so, it is not needed to
+ // update fillet arc: make the arc correct for sure, so, it is not needed to
// process the "attribute updated"
// by arc; moreover, it may cause cyclicity in hte mechanism of updater
aResultArc->data()->blockSendAttributeUpdated(true);
aTangentPntA = aTangentPntB;
aTangentPntB = aTmp;
}
- std::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aResultArc->attribute(SketchPlugin_Arc::START_ID()));
std::shared_ptr<GeomDataAPI_Point2D> aEndPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
int aFeatInd = isReversed ? 1 : 0;
int anAttrInd = (isReversed ? 2 : 0) + (isStart[isReversed ? 1 : 0] ? 0 : 1);
aRefAttr->setAttr(aResultFeatures[aFeatInd]->attribute(aFeatAttributes[anAttrInd]));
- recalculateAttributes(aResultArc, SketchPlugin_Arc::START_ID(),
+ recalculateAttributes(aResultArc, SketchPlugin_Arc::START_ID(),
aResultFeatures[aFeatInd], aFeatAttributes[anAttrInd]);
aConstraint->execute();
aFilletFeatures.resultConstraints.push_back(aConstraint);
aFeatInd = isReversed ? 0 : 1;
anAttrInd = (isReversed ? 0 : 2) + (isStart[isReversed ? 0 : 1] ? 0 : 1);
aRefAttr->setAttr(aResultFeatures[aFeatInd]->attribute(aFeatAttributes[anAttrInd]));
- recalculateAttributes(aResultArc, SketchPlugin_Arc::END_ID(),
+ recalculateAttributes(aResultArc, SketchPlugin_Arc::END_ID(),
aResultFeatures[aFeatInd], aFeatAttributes[anAttrInd]);
aConstraint->execute();
aFilletFeatures.resultConstraints.push_back(aConstraint);
aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
bool isArc = aResultFeatures[i]->getKind() == SketchPlugin_Arc::ID();
- aRefAttr->setObject(isArc ? aResultFeatures[i]->lastResult() :
+ aRefAttr->setObject(isArc ? aResultFeatures[i]->lastResult() :
aResultFeatures[i]->firstResult());
aConstraint->execute();
aFilletFeatures.resultConstraints.push_back(aConstraint);
myNewPoints.clear();
// Get list of points for fillets and current radius.
- AttributeRefAttrListPtr aRefListOfFilletPoints =
+ AttributeRefAttrListPtr aRefListOfFilletPoints =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(
data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
AttributeDoublePtr aRadiusAttribute = real(VALUE());
// Iterate over points to get base lines an calculate radius for fillets.
double aMinimumRadius = 0;
- std::list<std::pair<ObjectPtr, AttributePtr>>
+ std::list<std::pair<ObjectPtr, AttributePtr>>
aSelectedPointsList = aRefListOfFilletPoints->list();
std::list<std::pair<ObjectPtr, AttributePtr>>::iterator anIter = aSelectedPointsList.begin();
std::set<AttributePtr> aPointsToSkeep;
// Obtain constraint coincidence for the fillet point.
FeaturePtr aConstraintCoincidence;
const std::set<AttributePtr>& aRefsList = aFilletPointAttr->owner()->data()->refsToMe();
- for(std::set<AttributePtr>::const_iterator
+ for(std::set<AttributePtr>::const_iterator
anIt = aRefsList.cbegin(); anIt != aRefsList.cend(); ++anIt) {
std::shared_ptr<ModelAPI_Attribute> anAttr = (*anIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->owner());
SketchPlugin_ConstraintCoincidence::ENTITY_B(),
aCoincides);
- // Remove points from set of coincides.
+ // Remove points from set of coincides.
// Also get all attributes which is equal to this point to exclude it.
std::shared_ptr<GeomAPI_Pnt2d> aFilletPnt2d = aFilletPoint2D->pnt();
std::set<FeaturePtr> aNewSetOfCoincides;
- for(std::set<FeaturePtr>::iterator
+ for(std::set<FeaturePtr>::iterator
anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) {
std::string aFeatureKind = (*anIt)->getKind();
if(aFeatureKind == SketchPlugin_Point::ID()) {
// If we still have more than two coincides remove auxilary entities from set of coincides.
if(aCoincides.size() > 2) {
aNewSetOfCoincides.clear();
- for(std::set<FeaturePtr>::iterator
+ for(std::set<FeaturePtr>::iterator
anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) {
if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
aNewSetOfCoincides.insert(*anIt);
double aDistanceA = getProjectionDistance(anOldFeatureB, aPntA);
double aDistanceB = getProjectionDistance(anOldFeatureA, aPntB);
double aRadius = aDistanceA < aDistanceB ? aDistanceA / 2.0 : aDistanceB / 2.0;
- aMinimumRadius = aMinimumRadius == 0 ? aRadius :
+ aMinimumRadius = aMinimumRadius == 0 ? aRadius :
aRadius < aMinimumRadius ? aRadius : aMinimumRadius;
}
}
double aMedDist = (aRadA * aRadA - aRadB * aRadB + aCenterDist2) / (2.0 * aCenterDist);
double aHeight = sqrt(aRadA * aRadA - aMedDist * aMedDist);
- double x1 = theCenterA->x() +
+ double x1 = theCenterA->x() +
(aMedDist * aCenterDir->x() + aCenterDir->y() * aHeight) / aCenterDist;
- double y1 = theCenterA->y() +
+ double y1 = theCenterA->y() +
(aMedDist * aCenterDir->y() - aCenterDir->x() * aHeight) / aCenterDist;
- double x2 = theCenterA->x() +
+ double x2 = theCenterA->x() +
(aMedDist * aCenterDir->x() - aCenterDir->y() * aHeight) / aCenterDist;
- double y2 = theCenterA->y() +
+ double y2 = theCenterA->y() +
(aMedDist * aCenterDir->y() + aCenterDir->x() * aHeight) / aCenterDist;
std::shared_ptr<GeomAPI_XY> aPoint1(new GeomAPI_XY(x1, y1));
// get and filter possible centers
std::list< std::shared_ptr<GeomAPI_XY> > aSuspectCenters;
- possibleFilletCenterLineLine(aStart[0], aDir[0], aStart[1], aDir[1],
+ possibleFilletCenterLineLine(aStart[0], aDir[0], aStart[1], aDir[1],
theRadius, aSuspectCenters);
double aDot = 0.0;
std::list< std::shared_ptr<GeomAPI_XY> >::iterator anIt = aSuspectCenters.begin();
return;
}
} else if ((theFeatureA->getKind() == SketchPlugin_Arc::ID() &&
- theFeatureB->getKind() == SketchPlugin_Line::ID()) ||
+ theFeatureB->getKind() == SketchPlugin_Line::ID()) ||
(theFeatureA->getKind() == SketchPlugin_Line::ID() &&
theFeatureB->getKind() == SketchPlugin_Arc::ID())) {
int aLineInd = theFeatureA->getKind() == SketchPlugin_Line::ID() ? 0 : 1;
// get possible centers and filter them
std::list< std::shared_ptr<GeomAPI_XY> > aSuspectCenters;
- possibleFilletCenterLineArc(aStart[aLineInd], aDirLine, aCenter[1-aLineInd],
+ possibleFilletCenterLineArc(aStart[aLineInd], aDirLine, aCenter[1-aLineInd],
anArcRadius, theRadius, aSuspectCenters);
double aDot = 0.0;
// the line is forward into the arc
// get and filter possible centers
std::list< std::shared_ptr<GeomAPI_XY> > aSuspectCenters;
- possibleFilletCenterArcArc(aCenter[0], anArcRadius[0], aCenter[1],
+ possibleFilletCenterArcArc(aCenter[0], anArcRadius[0], aCenter[1],
anArcRadius[1], theRadius, aSuspectCenters);
double aDot = 0.0;
std::shared_ptr<GeomAPI_XY> aLineTgPoint, anArcTgPoint;
aPntEnd = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
theFeature->attribute(SketchPlugin_Line::START_ID()))->pnt();
}
- thePoint.reset(
- new GeomAPI_Pnt2d(aPntStart->xy()->added(
+ thePoint.reset(
+ new GeomAPI_Pnt2d(aPntStart->xy()->added(
aPntEnd->xy()->decreased( aPntStart->xy() )->multiplied(1.0 / 3.0) ) ) );
} else {
std::shared_ptr<GeomAPI_Pnt2d> aPntTemp;
{
std::set<FeaturePtr> aCoincides;
- std::shared_ptr<GeomAPI_Pnt2d> aFilletPnt =
+ std::shared_ptr<GeomAPI_Pnt2d> aFilletPnt =
SketchPlugin_Tools::getCoincidencePoint(theConstraintCoincidence);
SketchPlugin_Tools::findCoincidences(theConstraintCoincidence,
// If we still have more than two coincides remove auxilary entities from set of coincides.
if(aCoincides.size() > 2) {
aNewSetOfCoincides.clear();
- for(std::set<FeaturePtr>::iterator
+ for(std::set<FeaturePtr>::iterator
anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) {
if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
aNewSetOfCoincides.insert(*anIt);
/// \struct Struct to store base edges with states, result edges and constraints.
struct FilletFeatures {
/// list of objects the fillet is based and its states
- std::list<std::pair<FeaturePtr, bool>> baseEdgesState;
+ std::list<std::pair<FeaturePtr, bool>> baseEdgesState;
std::list<FeaturePtr> resultEdges; ///< list of result edges
std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
};
std::set<AttributePtr> myNewPoints; ///< set of new points
/// map of point and features for fillet
- std::map<AttributePtr, FilletFeatures> myPointFeaturesMap;
+ std::map<AttributePtr, FilletFeatures> myPointFeaturesMap;
bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
bool myRadiusChangedByUser; ///< flag to track that radius changed by user
bool myRadiusChangedInCode; ///< flag to track that radius changed in code
// aValueAttr->setValue(aLenght);
//}
- // the value should to be computed here, not in the getAISObject
+ // the value should to be computed here, not in the getAISObject
// in order to change the model value
// inside the object transaction. This is important for creating a constraint by preselection.
// The display of the presentation in this case happens after the transaction commit
- AttributePtr aFlyOutAttribute =
+ AttributePtr aFlyOutAttribute =
data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
if (!aFlyOutAttribute->isInitialized()) {
compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(theAttributeId));
- std::shared_ptr<GeomAPI_Lin2d> aLine =
+ std::shared_ptr<GeomAPI_Lin2d> aLine =
std::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt()));
- if (!aFlyOutAttr->isInitialized() ||
+ if (!aFlyOutAttr->isInitialized() ||
(fabs(aFlyOutAttr->x()) < tolerance && fabs(aFlyOutAttr->y()) < tolerance)) {
double aDist = aPoint1->distance(aPoint2)/5.;
std::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this,
+ AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this,
sketch()->coordinatePlane(), thePrevious);
return anAIS;
}
}
void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) {
- if (theID == SketchPlugin_Constraint::ENTITY_A())
+ if (theID == SketchPlugin_Constraint::ENTITY_A())
{
std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(attribute(SketchPlugin_Constraint::VALUE()));
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeRefList::typeId());
- data()->addAttribute(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(),
+ data()->addAttribute(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(),
ModelAPI_AttributeRefList::typeId());
ModelAPI_Session::get()->validators()->
registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B());
if (aMirrorIter != aMirroredList.end())
break; // the lists are inconsistent
// There is no mirrored object yet, create it
- FeaturePtr aNewFeature =
+ FeaturePtr aNewFeature =
SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeatureIn, sketch(), true);
aNewFeature->execute();
ModelAPI_EventCreator::get()->sendUpdated(aNewFeature, aRedisplayEvent);
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
std::list<ObjectPtr> aTargetList = aRefListOfMirrored->list();
- for(std::list<ObjectPtr>::const_iterator aTargetIt =
+ for(std::list<ObjectPtr>::const_iterator aTargetIt =
aTargetList.cbegin(); aTargetIt != aTargetList.cend(); aTargetIt++) {
if((*aTargetIt).get()) {
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(*aTargetIt);
if(aRes.get()) {
FeaturePtr aFeature = aRes->document()->feature(aRes);
if(aFeature.get()) {
- AttributeBooleanPtr aBooleanAttr =
+ AttributeBooleanPtr aBooleanAttr =
aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID());
if(aBooleanAttr.get()) {
if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this,
+ AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this,
sketch()->coordinatePlane(), thePrevious);
return anAIS;
}
GeomDataAPI_Point2D>(data()->attribute(theAttributeId));
// Prepare a circle
if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle
- std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
double aShift = aRadius * 1.1;
std::shared_ptr<GeomAPI_Pnt2d> aPnt = aCenterAttr->pnt();
- std::shared_ptr<GeomAPI_Pnt2d> aFPnt =
+ std::shared_ptr<GeomAPI_Pnt2d> aFPnt =
std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift));
aFlyoutAttr->setValue(aFPnt);
} else { // arc
std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
- GeomDataAPI_Point2D>(aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
+ GeomDataAPI_Point2D>(aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
aFlyoutAttr->setValue(aStartAttr->pnt());
}
return true;
if (theID == SketchPlugin_Constraint::ENTITY_A()) {
std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
- if (!aValueAttr->isInitialized()) {
+ if (!aValueAttr->isInitialized()) {
// only if it is not initialized, try to compute the current value
std::shared_ptr<ModelAPI_Feature> aCyrcFeature;
double aRadius = circleRadius(aCyrcFeature);
ObjectPtr aObj = anAttr->object();
if (aObj.get() != NULL) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
- std::shared_ptr<SketchPlugin_Feature> aSkFea =
+ std::shared_ptr<SketchPlugin_Feature> aSkFea =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (!aSkFea->isExternal())
+ if (!aSkFea->isExternal())
isValidRigid = true;
}
setError("Error: Base object is not initialized.");
return;
}
- AttributePoint2DPtr aFirstPointAttrOfSplit =
+ AttributePoint2DPtr aFirstPointAttrOfSplit =
getPointOfRefAttr(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
- AttributePoint2DPtr aSecondPointAttrOfSplit =
+ AttributePoint2DPtr aSecondPointAttrOfSplit =
getPointOfRefAttr(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
if (!aFirstPointAttrOfSplit.get() || !aFirstPointAttrOfSplit->isInitialized() ||
!aSecondPointAttrOfSplit.get() || !aSecondPointAttrOfSplit->isInitialized()) {
std::cout << std::endl;
if (!aCoincidenceToFeature.empty()) {
- std::cout << "Coincidences to base feature[" <<
+ std::cout << "Coincidences to base feature[" <<
aCoincidenceToFeature.size() << "]: " << std::endl;
std::map<FeaturePtr, IdToPointPair>::const_iterator anIt = aCoincidenceToFeature.begin(),
aLast = aCoincidenceToFeature.end();
std::cout << i << "-" << getFeatureInfo(aFeature) << std::endl;
std::cout << " -Attribute to correct:" << anAttributeId << std::endl;
- std::cout << " -Point attribute:" <<
+ std::cout << " -Point attribute:" <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aPointAttr) << std::endl;
}
}
std::cout << i << "-" << getFeatureInfo(aFeature) << std::endl;
std::cout << " -Attribute to correct:" << anAttributeId << std::endl;
- std::cout << " -Point attribute:" <<
+ std::cout << " -Point attribute:" <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aPointAttr) << std::endl;
}
}
- std::map<AttributePtr, std::list<AttributePtr> >::const_iterator
+ std::map<AttributePtr, std::list<AttributePtr> >::const_iterator
aRefIt = aBaseRefAttributes.begin(), aRefLast = aBaseRefAttributes.end();
- std::cout << std::endl << "References to attributes of base feature [" <<
+ std::cout << std::endl << "References to attributes of base feature [" <<
aBaseRefAttributes.size() << "]" << std::endl;
for (; aRefIt != aRefLast; aRefIt++) {
AttributePtr aBaseAttr = aRefIt->first;
FeaturePtr aRFeature = ModelAPI_Feature::feature(aRAttr->owner());
aRefsInfo.append("(" + aRFeature->name() + ") ");
}
- std::shared_ptr<GeomDataAPI_Point2D> aPointAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aPointAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aBaseAttr);
- std::cout << aPointAttr->id().c_str() <<
+ std::cout << aPointAttr->id().c_str() <<
": " << "[" << aRefAttributes.size() << "] " << aRefsInfo << std::endl;
}
std::cout << std::endl;
- std::cout << std::endl << "References to base feature [" <<
+ std::cout << std::endl << "References to base feature [" <<
aRefsToFeature.size() << "]" << std::endl;
std::list<AttributePtr>::const_iterator aRefAttrIt = aRefsToFeature.begin(),
aRefAttrLast = aRefsToFeature.end();
aModifiedAttributes);
if (aFeatureKind == SketchPlugin_Circle::ID()) {
FeaturePtr aCircleFeature = aBaseFeature;
- splitCircle(aSplitFeature, aBaseFeature, anAfterFeature, aFurtherCoincidences,
+ splitCircle(aSplitFeature, aBaseFeature, anAfterFeature, aFurtherCoincidences,
aCreatedFeatures, aModifiedAttributes);
updateRefFeatureConstraints(getFeatureResult(aBaseFeature), aRefsToFeature);
}
std::cout << "Modifed attributes (constraints to attributes are moved here):" << std::endl;
- std::set<std::pair<AttributePtr, AttributePtr> >::const_iterator
+ std::set<std::pair<AttributePtr, AttributePtr> >::const_iterator
aPIt = aModifiedAttributes.begin(), aPLast = aModifiedAttributes.end();
std::string aResInfo;
for (; aPIt != aPLast; aPIt++) {
aPoints.push_back(aStartPoint);
std::shared_ptr<GeomAPI_Pnt2d> aSecondPnt2d = aSecondPointAttrOfSplit->pnt();
- std::shared_ptr<GeomAPI_Pnt> aSecondPoint =
+ std::shared_ptr<GeomAPI_Pnt> aSecondPoint =
sketch()->to3D(aSecondPnt2d->x(), aSecondPnt2d->y());
aPoints.push_back(aSecondPoint);
std::set<std::shared_ptr<GeomAPI_Shape> > aSplitShapes;
GeomAlgoAPI_ShapeTools::splitShape(aBaseShape, aPoints, aSplitShapes);
- std::shared_ptr<GeomAPI_Shape> aShape =
+ std::shared_ptr<GeomAPI_Shape> aShape =
GeomAlgoAPI_ShapeTools::findShape(aPoints, aSplitShapes);
AISObjectPtr anAIS = thePrevious;
AttributePoint2DPtr aPointAttribute;
if (theAttribute->attributeType() == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr.get() && aRefAttr->isInitialized()) {
AttributePtr anAttribute = aRefAttr->attr();
else if (aRefFeatureKind == SketchPlugin_ConstraintTangent::ID()) {
if (aBaseFeature->getKind() == SketchPlugin_Circle::ID()) /// TEMPORARY limitaion
/// until tangency between arc and line is implemented
- theFeaturesToDelete.insert(aRefFeature);
+ theFeaturesToDelete.insert(aRefFeature);
else {
std::string anAttributeToBeModified;
AttributePoint2DPtr aTangentPoint;
ObjectPtr aResult1 = aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_A())->object();
ObjectPtr aResult2 = aRefFeature->refattr(SketchPlugin_Constraint::ENTITY_B())->object();
if (aResult1.get() && aResult2.get()) {
- FeaturePtr aCoincidenceFeature =
+ FeaturePtr aCoincidenceFeature =
SketchPlugin_ConstraintCoincidence::findCoincidenceFeature
(ModelAPI_Feature::feature(aResult1),
ModelAPI_Feature::feature(aResult2));
theTangentFeatures[aRefFeature] = std::make_pair(anAttributeToBeModified, aTangentPoint);
}
else /// there is not coincident point between tangent constraint
- theFeaturesToDelete.insert(aRefFeature);
+ theFeaturesToDelete.insert(aRefFeature);
}
}
else if (aRefFeatureKind == SketchPlugin_ConstraintCoincidence::ID()) {
{
theRefs.clear();
- std::list<AttributePtr> aPointAttributes =
+ std::list<AttributePtr> aPointAttributes =
theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
std::set<AttributePtr> aPointAttributesSet;
- std::list<AttributePtr>::const_iterator aPIt =
+ std::list<AttributePtr>::const_iterator aPIt =
aPointAttributes.begin(), aPLast = aPointAttributes.end();
for (; aPIt != aPLast; aPIt++)
aPointAttributesSet.insert(*aPIt);
AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttr);
if (!aRefAttr->isObject()) { /// find attributes referenced to feature point attributes
AttributePtr anAttrInRef = aRefAttr->attr();
- if (anAttrInRef.get() &&
+ if (anAttrInRef.get() &&
aPointAttributesSet.find(anAttrInRef) != aPointAttributesSet.end()) {
if (theRefs.find(anAttrInRef) != theRefs.end())
theRefs[anAttrInRef].push_back(aRefAttr);
aFeaturePointAttribute = aFCAttribute;
}
if (aFeaturePointAttribute.get()) {
- FeaturePtr aFeature =
+ FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(aFeaturePointAttribute->owner());
aTangentFeature->refattr(anAttributeId)->setObject(getFeatureResult(aFeature));
}
std::cout << "SketchPlugin_ConstraintSplit::updateRefAttConstraints" << std::endl;
#endif
- std::set<std::pair<AttributePtr, AttributePtr> >::const_iterator
+ std::set<std::pair<AttributePtr, AttributePtr> >::const_iterator
anIt = theModifiedAttributes.begin(), aLast = theModifiedAttributes.end();
for (; anIt != aLast; anIt++) {
AttributePtr anAttribute = anIt->first;
/// not found in references
- if (theBaseRefAttributes.find(anAttribute) == theBaseRefAttributes.end())
+ if (theBaseRefAttributes.find(anAttribute) == theBaseRefAttributes.end())
continue;
std::list<AttributePtr> aRefAttributes = theBaseRefAttributes.at(anAttribute);
std::list<AttributePtr>::const_iterator aRefIt = aRefAttributes.begin(),
if (aFeatureKind != SketchPlugin_Line::ID())
return;
- AttributePoint2DPtr aFirstPointAttrOfSplit =
+ AttributePoint2DPtr aFirstPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
- AttributePoint2DPtr aSecondPointAttrOfSplit =
+ AttributePoint2DPtr aSecondPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_B()));
AttributePoint2DPtr aStartPointAttrOfBase, anEndPointAttrOfBase;
getFeaturePoints(aStartPointAttrOfBase, anEndPointAttrOfBase);
return;
}
- arrangePointsOnLine(aStartPointAttrOfBase, anEndPointAttrOfBase,
+ arrangePointsOnLine(aStartPointAttrOfBase, anEndPointAttrOfBase,
aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
#ifdef DEBUG_SPLIT
std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl;
- std::cout << "Start point: " <<
+ std::cout << "Start point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aStartPointAttrOfBase) << std::endl;
- std::cout << "1st point: " <<
+ std::cout << "1st point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aFirstPointAttrOfSplit) << std::endl;
- std::cout << "2nd point: " <<
+ std::cout << "2nd point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aSecondPointAttrOfSplit) << std::endl;
- std::cout << "End point: " <<
+ std::cout << "End point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(anEndPointAttrOfBase) << std::endl;
#endif
/// create a split feature
- theSplitFeature =
+ theSplitFeature =
createLineFeature(aBaseFeature, aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
theCreatedFeatures.insert(theSplitFeature);
// before split feature
if (!aStartPointAttrOfBase->pnt()->isEqual(aFirstPointAttrOfSplit->pnt())) {
/// move end arc point to start of split
- fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()),
+ fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()),
aFirstPointAttrOfSplit);
theBaseFeatureModified->execute(); // to update result
aConstraintFeature = createConstraint(SketchPlugin_ConstraintCoincidence::ID(),
if (aFeatureKind != SketchPlugin_Arc::ID())
return;
- AttributePoint2DPtr aFirstPointAttrOfSplit =
+ AttributePoint2DPtr aFirstPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
- AttributePoint2DPtr aSecondPointAttrOfSplit =
+ AttributePoint2DPtr aSecondPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_B()));
AttributePoint2DPtr aStartPointAttrOfBase, anEndPointAttrOfBase;
getFeaturePoints(aStartPointAttrOfBase, anEndPointAttrOfBase);
aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
#ifdef DEBUG_SPLIT
std::cout << "Arranged points (to build split between 1st and 2nd points:" << std::endl;
- std::cout << "Start point: " <<
+ std::cout << "Start point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aStartPointAttrOfBase) << std::endl;
- std::cout << "1st point: " <<
+ std::cout << "1st point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aFirstPointAttrOfSplit) << std::endl;
- std::cout << "2nd point: " <<
+ std::cout << "2nd point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(aSecondPointAttrOfSplit) << std::endl;
- std::cout << "End point: " <<
+ std::cout << "End point: " <<
ModelGeomAlgo_Point2D::getPointAttributeInfo(anEndPointAttrOfBase) << std::endl;
#endif
if (aFeatureKind != SketchPlugin_Circle::ID())
return;
- AttributePoint2DPtr aFirstPointAttrOfSplit =
+ AttributePoint2DPtr aFirstPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
- AttributePoint2DPtr aSecondPointAttrOfSplit =
+ AttributePoint2DPtr aSecondPointAttrOfSplit =
getPointOfRefAttr(data()->attribute(SketchPlugin_Constraint::ENTITY_B()));
/// split feature
- theSplitFeature =
+ theSplitFeature =
createArcFeature(aBaseFeature, aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
bool aSplitReversed = std::dynamic_pointer_cast<SketchPlugin_Arc>(theSplitFeature)->isReversed();
theCreatedFeatures.insert(theSplitFeature);
/// base feature is a left part of the circle
- theBaseFeatureModified = createArcFeature(aBaseFeature,
+ theBaseFeatureModified = createArcFeature(aBaseFeature,
aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
std::dynamic_pointer_cast<SketchPlugin_Arc>(
theBaseFeatureModified)->setReversed(!aSplitReversed);
return aFeature;
aFeature = aSketch->addFeature(SketchPlugin_Arc::ID());
- // update fillet arc: make the arc correct for sure, so, it is not needed to process
+ // update fillet arc: make the arc correct for sure, so, it is not needed to process
// the "attribute updated"
// by arc; moreover, it may cause cyclicity in hte mechanism of updater
aFeature->data()->blockSendAttributeUpdated(true);
std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature,
getEdgeAttributes(theFeature));
/// processing of feature with point 2d attributes, like line, arc, circle
- if (!aPointsInfo.empty()) {
+ if (!aPointsInfo.empty()) {
anInfo += ": ";
anInfo += "\n";
anInfo += aPointsInfo;
std::map<std::shared_ptr<ModelAPI_Feature>, IdToPointPair>& theCoincidenceToPoint*/);
/// Obtains references to feature point attributes and to feature,
- /// e.g. for feature line: 1st container is
+ /// e.g. for feature line: 1st container is
/// <1st line point, list<entity_a in distance, entity_b in parallel> >
/// <2nd line point, list<> >
/// for feature circle 2nd container is <entity_a in Radius, entity_b in equal, ...>
/// \param theAfterFeature a feature between last point of split feature and the end point
/// \param thePoints a list of points where coincidences will be build
/// \param theCreatedFeatures a container of created features
- /// \param theModifiedAttributes a container of attribute on base
+ /// \param theModifiedAttributes a container of attribute on base
/// feature to attribute on new feature
void splitLine(std::shared_ptr<ModelAPI_Feature>& theSplitFeature,
std::shared_ptr<ModelAPI_Feature>& theBeforeFeature,
bool SketchPlugin_ExternalValidator::isExternalAttribute(const AttributePtr& theAttribute) const
{
bool isExternal = false;
- AttributeRefAttrPtr anAttribute =
+ AttributeRefAttrPtr anAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anAttribute.get() != NULL) {
class SketchPlugin_ExternalValidator : public ModelAPI_AttributeValidator
{
public:
- /// returns true if the feature of attribute do not contain external features
+ /// returns true if the feature of attribute do not contain external features
/// in the given attribute and
/// among attributes listed in the arguments
/// \param theAttribute an attribute to check
const std::set<AttributePtr>& aBackRefs = data()->refsToMe();
std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
for(; aBackRef != aBackRefs.end(); aBackRef++) {
- std::shared_ptr<SketchPlugin_Sketch> aSketch =
+ std::shared_ptr<SketchPlugin_Sketch> aSketch =
std::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
if (aSketch) {
mySketch = aSketch.get();
std::shared_ptr<GeomAPI_Edge> anEdge;
if(aLineAttr && aLineAttr->value() && aLineAttr->value()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLineAttr->value()));
- } else if(aLineAttr->context() && aLineAttr->context()->shape() &&
+ } else if(aLineAttr->context() && aLineAttr->context()->shape() &&
aLineAttr->context()->shape()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLineAttr->context()->shape()));
}
if (!anIntersection)
return;
- std::shared_ptr<GeomDataAPI_Point2D> aCoordAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aCoordAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(COORD_ID()));
aCoordAttr->setValue(sketch()->to2D(anIntersection));
}
double aDelta = 0;
std::shared_ptr<ModelAPI_Data> aData = data();
- std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(START_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(END_ID()));
GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
// update arguments due to the selection value
if (aSelection && !aSelection->isNull() && aSelection->isEdge()) {
std::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
- std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_ID()));
aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint()));
- std::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(END_ID()));
anEndAttr->setValue(sketch()->to2D(anEdge->lastPoint()));
updateLenghtValue();
if (!(*aUsedIter)) {
aRefListOfShapes->remove(*anInitIter);
aRefListOfRotated->remove(*aTargetIter++);
- for (int i = 0; i < aCurrentNbCopies && aTargetIter != aTargetList.end();
+ for (int i = 0; i < aCurrentNbCopies && aTargetIter != aTargetList.end();
i++, aTargetIter++) {
aRefListOfRotated->remove(*aTargetIter);
// remove the corresponding feature from the sketch
if(aRes.get()) {
FeaturePtr aFeature = aRes->document()->feature(aRes);
if(aFeature.get()) {
- AttributeBooleanPtr aBooleanAttr =
+ AttributeBooleanPtr aBooleanAttr =
aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID());
if(aBooleanAttr.get()) {
if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo
if (!aFeature || !aResult)
return ObjectPtr();
- FeaturePtr aNewFeature =
+ FeaturePtr aNewFeature =
SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeature, sketch(), true);
aNewFeature->execute();
if (!aStart || !aEnd)
return;
- std::shared_ptr<GeomAPI_XY>
+ std::shared_ptr<GeomAPI_XY>
aShiftVec(new GeomAPI_XY(aEnd->x() - aStart->x(), aEnd->y() - aStart->y()));
// Wait all objects being created, then send update events
if (!(*aUsedIter)) {
aRefListOfShapes->remove(*anInitIter);
aRefListOfTranslated->remove(*aTargetIter++);
- for (int i = 0; i < aCurrentNbCopies && aTargetIter != aTargetList.end();
+ for (int i = 0; i < aCurrentNbCopies && aTargetIter != aTargetList.end();
i++, aTargetIter++) {
aRefListOfTranslated->remove(*aTargetIter);
// remove the corresponding feature from the sketch
if(aRes.get()) {
FeaturePtr aFeature = aRes->document()->feature(aRes);
if(aFeature.get()) {
- AttributeBooleanPtr aBooleanAttr =
+ AttributeBooleanPtr aBooleanAttr =
aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID());
if(aBooleanAttr.get()) {
if (ModelAPI_Session::get()->isOperation()) // if this is not undo or redo
if (!aFeature || !aResult)
return ObjectPtr();
- FeaturePtr aNewFeature =
+ FeaturePtr aNewFeature =
SketchPlugin_Sketch::addUniqueNamedCopiedFeature(aFeature, sketch(), true);
aNewFeature->execute();
SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("SketchPlugin_DistanceAttr",
- new SketchPlugin_DistanceAttrValidator);
+ new SketchPlugin_DistanceAttrValidator);
aFactory->registerValidator("SketchPlugin_ExternalValidator",
new SketchPlugin_ExternalValidator);
aFactory->registerValidator("SketchPlugin_TangentAttr",
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
-
- Config_PropManager::registerProp("Visualization", "sketch_entity_color",
+
+ Config_PropManager::registerProp("Visualization", "sketch_entity_color",
"Sketch entity color",
Config_Prop::Color, SKETCH_ENTITY_COLOR);
- Config_PropManager::registerProp("Visualization", "sketch_external_color",
+ Config_PropManager::registerProp("Visualization", "sketch_external_color",
"Sketch external entity color",
Config_Prop::Color, SKETCH_EXTERNAL_COLOR);
- Config_PropManager::registerProp("Visualization", "sketch_auxiliary_color",
+ Config_PropManager::registerProp("Visualization", "sketch_auxiliary_color",
"Sketch auxiliary entity color",
Config_Prop::Color, SKETCH_AUXILIARY_COLOR);
- Config_PropManager::registerProp("Visualization", "sketch_dimension_color",
+ Config_PropManager::registerProp("Visualization", "sketch_dimension_color",
"Sketch dimension color",
Config_Prop::Color, SKETCH_DIMENSION_COLOR);
// update arguments due to the selection value
if (aSelection && !aSelection->isNull() && aSelection->isVertex()) {
std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aSelection));
- std::shared_ptr<GeomDataAPI_Point2D> aCoordAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aCoordAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(COORD_ID()));
aCoordAttr->setValue(sketch()->to2D(aVertex->point()));
}
std::shared_ptr<GeomAPI_Edge> anEdge;
if (aExtFeature && aExtFeature->value() && aExtFeature->value()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aExtFeature->value()));
- } else if (aExtFeature->context() && aExtFeature->context()->shape() &&
+ } else if (aExtFeature->context() && aExtFeature->context()->shape() &&
aExtFeature->context()->shape()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aExtFeature->context()->shape()));
}
aProjection = sketch()->addFeature(SketchPlugin_Circle::ID());
// update attributes of projection
- std::shared_ptr<GeomDataAPI_Point2D> aCenterPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aProjection->attribute(SketchPlugin_Circle::CENTER_ID()));
aCenterPnt->setValue(aCenterInSketch);
aProjection = sketch()->addFeature(SketchPlugin_Arc::ID());
// update attributes of projection
- std::shared_ptr<GeomDataAPI_Point2D> aCenterPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aProjection->attribute(SketchPlugin_Arc::CENTER_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aStartPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aStartPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aProjection->attribute(SketchPlugin_Arc::START_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aEndPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aEndPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aProjection->attribute(SketchPlugin_Arc::END_ID()));
aStartPnt->setValue(aFirstInSketch);
data()->addAttribute(SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir::typeId());
data()->addAttribute(SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList::typeId());
// the selected face, base for the sketcher plane, not obligatory
- data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(),
+ data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(),
ModelAPI_AttributeSelection::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(
getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID());
if (!data()->isValid()) // sketch is already removed (case on undo of sketch), sync is not needed
return;
AttributeRefListPtr aList = reflist(SketchPlugin_Sketch::FEATURES_ID());
- // if the object is last, remove it from the list
+ // if the object is last, remove it from the list
// (needed to skip empty transaction on edit of sketch feature)
if (aList->object(aList->size(true) - 1, true) == theFeature) {
aList->remove(theFeature);
int aResultIndex = 1; // number of the counted (created) features, started from 1
int aFeatureIndex = -1; // number of the not-empty features in the list
for (; anIt != aFeatures.end(); anIt++) {
- if (anIt->get())
+ if (anIt->get())
aFeatureIndex++;
if (aFeatureIndex == theIndex)
break;
void SketchPlugin_Sketch::attributeChanged(const std::string& theID) {
if (theID == SketchPlugin_SketchEntity::EXTERNAL_ID()) {
- std::shared_ptr<GeomAPI_Shape> aSelection =
+ std::shared_ptr<GeomAPI_Shape> aSelection =
data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->value();
if (aSelection) { // update arguments due to the selection value
// update the sketch plane
std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
// X axis is preferable to be dirX on the sketch
// here can not be very small value to avoid very close to X normal axis (issue 595)
- static const double tol = 0.1;
+ static const double tol = 0.1;
bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
std::shared_ptr<GeomAPI_Dir> aTempDir(
isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
}
-
+
/// Returns the point projected into the sketch plane
/// \param thePnt a source 3d point
std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& thePnt) const
SKETCHPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
/// Returns the sub-feature by zero-base index
- SKETCHPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ SKETCHPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
subFeature(const int theIndex, bool forTree = false);
/// Returns the sub-feature unique identifier in this composite feature by index
static void createPoint2DResult(ModelAPI_Feature* theFeature,
SketchPlugin_Sketch* theSketch,
const std::string& theAttributeID, const int theIndex);
-
+
/// Add new feature and fill the data of the feature by the data of the parameter feature.
/// The name of the created feature stays unique.
/// \param theFeature a source feature
// apply the color of the result to the presentation
if (theDefaultPrs.get())
isCustomized = theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
- // set the sketch presentation bold
+ // set the sketch presentation bold
isCustomized = thePrs->setWidth(2) || isCustomized;
-
+
return isCustomized;
}
initDerivedClassAttributes();
- AttributePtr anAttr = data()->addAttribute(SketchPlugin_SketchEntity::COPY_ID(),
+ AttributePtr anAttr = data()->addAttribute(SketchPlugin_SketchEntity::COPY_ID(),
ModelAPI_AttributeBoolean::typeId());
anAttr->setIsArgument(false);
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
SketchPlugin_SketchEntity::COPY_ID());
}
bool isCustomized = theDefaultPrs.get() != NULL &&
theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
int aShapeType = thePrs->getShapeType();
- // a compound is processed like the edge because the
+ // a compound is processed like the edge because the
// arc feature uses the compound for presentable AIS
if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/)
return false;
void clearExpressions(AttributePtr theAttribute)
{
// Double
- AttributeDoublePtr anAttributeDouble =
+ AttributeDoublePtr anAttributeDouble =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
if (anAttributeDouble.get())
clearExpressions(anAttributeDouble);
// Point
- AttributePointPtr anAttributePoint =
+ AttributePointPtr anAttributePoint =
std::dynamic_pointer_cast<GeomDataAPI_Point>(theAttribute);
if (anAttributePoint.get())
clearExpressions(anAttributePoint);
// Point2D
- AttributePoint2DPtr anAttributePoint2D =
+ AttributePoint2DPtr anAttributePoint2D =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (anAttributePoint2D.get())
clearExpressions(anAttributePoint2D);
if (!theFeature.get())
return;
- std::list<AttributePtr> anAttributes = theFeature->data()->attributes(std::string());
+ std::list<AttributePtr> anAttributes = theFeature->data()->attributes(std::string());
std::list<AttributePtr>::iterator anAttributeIt = anAttributes.begin();
for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) {
clearExpressions(*anAttributeIt);
std::shared_ptr<GeomAPI_Pnt2d> getCoincidencePoint(const FeaturePtr theStartCoin)
{
- std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
SketchPlugin_Constraint::ENTITY_A());
if (aPnt.get() == NULL)
aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B());
namespace SketchPlugin_Tools {
-/// Clears text expressions for all attributes of the feature
+/// Clears text expressions for all attributes of the feature
void clearExpressions(FeaturePtr theFeature);
/// \return coincidence point
const double tolerance = 1.e-7;
-bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
// 1. check whether the references object is a linear
ObjectPtr anObject = aRefAttr->object();
- const ModelAPI_AttributeValidator* aShapeValidator =
+ const ModelAPI_AttributeValidator* aShapeValidator =
dynamic_cast<const ModelAPI_AttributeValidator*>(
aFactory->validator("GeomValidators_ShapeType"));
std::list<std::string> anArguments;
theError = "Circle can not be used in distance constraint";
return false;
}
-
+
anArguments.clear();
anArguments.push_back("line");
Events_InfoMessage aLineError;
for(std::set<AttributePtr>::const_iterator aRefIt = aRefsList.begin();
aRefIt != aRefsList.end();
++aRefIt) {
- // Find constraint
+ // Find constraint
FeaturePtr aRefFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
if(aRefFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
continue;
return (isCoincident(theFeature1, theFeature2) && isCoincident(theFeature2, theFeature1));
}
-bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
- FeaturePtr anAttributeFeature =
+ FeaturePtr anAttributeFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeRefAttrPtr aRefAttr =
+ AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
bool isObject = aRefAttr->isObject();
return true;
}
-bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
return true;
}
-bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
return true;
}
-bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
return false;
}
- AttributeRefAttrPtr aRefAttrB =
+ AttributeRefAttrPtr aRefAttrB =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
// first attribute is a point, it may coincide with any object
}
-bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
}
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeRefListPtr aSelAttr =
+ AttributeRefListPtr aSelAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
AttributeRefListPtr aRefListOfInitial = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
return true;
}
-bool SketchPlugin_SolverErrorValidator::isNotObligatory(std::string theFeature,
+bool SketchPlugin_SolverErrorValidator::isNotObligatory(std::string theFeature,
std::string theAttribute)
{
return true;
}
-static bool hasSameTangentFeature(const std::set<AttributePtr>& theRefsList,
+static bool hasSameTangentFeature(const std::set<AttributePtr>& theRefsList,
const FeaturePtr theFeature)
{
- for(std::set<AttributePtr>::const_iterator
+ for(std::set<AttributePtr>::const_iterator
anIt = theRefsList.cbegin(); anIt != theRefsList.cend(); ++anIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*anIt);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
- std::shared_ptr<SketchPlugin_ConstraintFillet> aFilletFeature =
+ std::shared_ptr<SketchPlugin_ConstraintFillet> aFilletFeature =
std::dynamic_pointer_cast<SketchPlugin_ConstraintFillet>(theAttribute->owner());
- AttributeRefAttrListPtr aPointsRefList =
+ AttributeRefAttrListPtr aPointsRefList =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
if(aPointsRefList->size() == 0) {
theError = "Error: List of points is empty.";
return false;
}
- std::map<AttributePtr, SketchPlugin_ConstraintFillet::FilletFeatures> aPointsFeaturesMap =
+ std::map<AttributePtr, SketchPlugin_ConstraintFillet::FilletFeatures> aPointsFeaturesMap =
aFilletFeature->pointsFeaturesMap();
std::set<AttributePtr> aSetOfPointsOnResultEdges;
- for(std::map<AttributePtr, SketchPlugin_ConstraintFillet::FilletFeatures>::iterator
+ for(std::map<AttributePtr, SketchPlugin_ConstraintFillet::FilletFeatures>::iterator
aPointsIter = aPointsFeaturesMap.begin();
aPointsIter != aPointsFeaturesMap.end();
++aPointsIter) {
}
std::list<std::pair<ObjectPtr, AttributePtr>> aPointsList = aPointsRefList->list();
- for(std::list<std::pair<ObjectPtr, AttributePtr>>::const_iterator
+ for(std::list<std::pair<ObjectPtr, AttributePtr>>::const_iterator
aPointsIt = aPointsList.cbegin(); aPointsIt != aPointsList.cend(); aPointsIt++) {
ObjectPtr anObject = (*aPointsIt).first;
AttributePtr aPointAttribute = (*aPointsIt).second;
if (!aPointAttribute.get())
return false;
- std::shared_ptr<GeomAPI_Pnt2d> aSelectedPnt =
+ std::shared_ptr<GeomAPI_Pnt2d> aSelectedPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aPointAttribute)->pnt();
// If we alredy have some result then:
// Obtain constraint coincidence for the fillet point.
const std::set<AttributePtr>& aRefsList = aPointAttribute->owner()->data()->refsToMe();
FeaturePtr aConstraintCoincidence;
- for(std::set<AttributePtr>::const_iterator anIt = aRefsList.cbegin();
+ for(std::set<AttributePtr>::const_iterator anIt = aRefsList.cbegin();
anIt != aRefsList.cend(); ++anIt) {
std::shared_ptr<ModelAPI_Attribute> aAttr = (*anIt);
FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
// Remove points from set of coincides.
std::set<FeaturePtr> aNewSetOfCoincides;
- for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
+ for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
anIt != aCoinsides.end(); ++anIt) {
if((*anIt)->getKind() != SketchPlugin_Line::ID() &&
(*anIt)->getKind() != SketchPlugin_Arc::ID()) {
}
if((*anIt)->getKind() == SketchPlugin_Arc::ID()) {
AttributePtr anArcCenter = (*anIt)->attribute(SketchPlugin_Arc::CENTER_ID());
- std::shared_ptr<GeomAPI_Pnt2d> anArcCenterPnt =
+ std::shared_ptr<GeomAPI_Pnt2d> anArcCenterPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anArcCenter)->pnt();
double aDistSelectedArcCenter = aSelectedPnt->distance(anArcCenterPnt);
if(aDistSelectedArcCenter < tolerance) {
// If we still have more than two coincides remove auxilary entities from set of coincides.
if(aCoinsides.size() > 2) {
aNewSetOfCoincides.clear();
- for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
+ for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
anIt != aCoinsides.end(); ++anIt) {
if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
aNewSetOfCoincides.insert(*anIt);
}
std::list<ResultPtr> aFirstResults = aFirstFeature->results();
- for(std::list<ResultPtr>::iterator aResIt = aFirstResults.begin();
+ for(std::list<ResultPtr>::iterator aResIt = aFirstResults.begin();
aResIt != aFirstResults.end(); ++aResIt) {
ResultPtr aRes = *aResIt;
const std::set<AttributePtr>& aResRefsList = aRes->data()->refsToMe();
}
// Check that lines not collinear
- if(aFirstFeature->getKind() == SketchPlugin_Line::ID() &&
+ if(aFirstFeature->getKind() == SketchPlugin_Line::ID() &&
aSecondFeature->getKind() == SketchPlugin_Line::ID()) {
std::string aStartAttr = SketchPlugin_Line::START_ID();
std::string anEndAttr = SketchPlugin_Line::END_ID();
std::shared_ptr<GeomAPI_Pnt2d> aFirstStartPnt, aFirstEndPnt, aSecondStartPnt, aSecondEndPnt;
- aFirstStartPnt =
+ aFirstStartPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFirstFeature->attribute(aStartAttr))->pnt();
- aFirstEndPnt =
+ aFirstEndPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFirstFeature->attribute(anEndAttr))->pnt();
aSecondStartPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aSecondFeature->attribute(aStartAttr))->pnt();
- aSecondEndPnt =
+ aSecondEndPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aSecondFeature->attribute(anEndAttr))->pnt();
- double aCheck1 =
- fabs((aFirstEndPnt->x() - aFirstStartPnt->x()) *
+ double aCheck1 =
+ fabs((aFirstEndPnt->x() - aFirstStartPnt->x()) *
(aSecondStartPnt->y() - aFirstStartPnt->y()) -
(aSecondStartPnt->x() - aFirstStartPnt->x()) * (aFirstEndPnt->y() - aFirstStartPnt->y()));
- double aCheck2 =
- fabs((aFirstEndPnt->x() - aFirstStartPnt->x()) *
+ double aCheck2 =
+ fabs((aFirstEndPnt->x() - aFirstStartPnt->x()) *
(aSecondEndPnt->y() - aFirstStartPnt->y()) -
(aSecondEndPnt->x() - aFirstStartPnt->x()) * (aFirstEndPnt->y() - aFirstStartPnt->y()));
if(aCheck1 < 1.e-7 && aCheck2 < 1.e-7) {
return true;
}
-bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttribute,
+bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
{
SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
- FeaturePtr anAttributeFeature =
+ FeaturePtr anAttributeFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
AttributeRefAttrPtr anOtherAttr = anAttributeFeature->data()->refattr(aParamA);
std::shared_ptr<GeomAPI_Edge> anEdge;
if(aLineAttr && aLineAttr->value() && aLineAttr->value()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLineAttr->value()));
- } else if(aLineAttr->context() &&
+ } else if(aLineAttr->context() &&
aLineAttr->context()->shape() && aLineAttr->context()->shape()->isEdge()) {
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLineAttr->context()->shape()));
}
// coincidences to the feature
std::set<std::shared_ptr<GeomDataAPI_Point2D> > aRefAttributes;
- ModelGeomAlgo_Point2D::getPointsOfReference(anAttrFeature,
+ ModelGeomAlgo_Point2D::getPointsOfReference(anAttrFeature,
SketchPlugin_ConstraintCoincidence::ID(),
aRefAttributes, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID());
std::shared_ptr<SketchPlugin_Feature> aSFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(anAttrFeature);
SketchPlugin_Sketch* aSketch = aSFeature->sketch();
-
+
std::shared_ptr<ModelAPI_Data> aData = aSketch->data();
std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
std::shared_ptr<GeomAPI_Dir> aDirY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
-
+
std::list<std::shared_ptr<GeomAPI_Pnt> > aPoints;
- std::map<std::shared_ptr<GeomDataAPI_Point2D>, std::shared_ptr<GeomAPI_Pnt> >
+ std::map<std::shared_ptr<GeomDataAPI_Point2D>, std::shared_ptr<GeomAPI_Pnt> >
aPointToAttributes;
ModelGeomAlgo_Point2D::getPointsInsideShape(anAttrShape, aRefAttributes, aC->pnt(),
aX->dir(), aDirY, aPoints, aPointToAttributes);
static ConstraintWrapperPtr
- createConstraintCoincidence(ConstraintPtr theConstraint,
+ createConstraintCoincidence(ConstraintPtr theConstraint,
const GroupID& theGroupID,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint1,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint2);
static ConstraintWrapperPtr
- createConstraintPointOnEntity(ConstraintPtr theConstraint,
+ createConstraintPointOnEntity(ConstraintPtr theConstraint,
const GroupID& theGroupID,
const SketchSolver_ConstraintType& theType,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
if (!aPoint2 && theEntity2->type() == ENTITY_POINT)
aPoint2 = GCS_POINT_WRAPPER( GCS_ENTITY_WRAPPER(theEntity2)->subEntities().front() );
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> aMirrorLine =
+ std::shared_ptr<PlaneGCSSolver_EntityWrapper> aMirrorLine =
std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theMirrorLine);
std::shared_ptr<GCS::Line> aLine =
std::dynamic_pointer_cast<GCS::Line>(aMirrorLine->entity());
aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end());
}
else if (theEntity1->type() == ENTITY_ARC) {
- // Do not allow mirrored arc recalculate its position until
+ // Do not allow mirrored arc recalculate its position until
// coordinated of all points recalculated
FeaturePtr aMirrArc = theEntity2->baseFeature();
aMirrArc->data()->blockSendAttributeUpdated(true);
aMrrList = createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine);
aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end());
- // make symmetric last point of original arc and first point of
+ // make symmetric last point of original arc and first point of
// mirrored arc without additional constraint
++anIt1;
--anIt2;
0.0, EntityWrapperPtr(), EntityWrapperPtr(), theEntity1, theEntity2);
aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end());
// ... and make parametric length of arcs the same
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anArcEnt1 =
+ std::shared_ptr<PlaneGCSSolver_EntityWrapper> anArcEnt1 =
std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity1);
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anArcEnt2 =
+ std::shared_ptr<PlaneGCSSolver_EntityWrapper> anArcEnt2 =
std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity2);
std::shared_ptr<GCS::Arc> anArc1 = std::dynamic_pointer_cast<GCS::Arc>(anArcEnt1->entity());
std::shared_ptr<GCS::Arc> anArc2 = std::dynamic_pointer_cast<GCS::Arc>(anArcEnt2->entity());
const GroupID& theGroupID,
AttributeDoublePtr theDoubleAttr)
{
- ParameterWrapperPtr aParam =
+ ParameterWrapperPtr aParam =
createParameter(theGroupID, theDoubleAttr ? theDoubleAttr->value() : 0.0);
return std::shared_ptr<PlaneGCSSolver_ScalarWrapper>(
new PlaneGCSSolver_ScalarWrapper(theDoubleAttr, aParam));
std::shared_ptr<PlaneGCSSolver_PointWrapper> aStartEnt, aEndEnt;
std::list<EntityWrapperPtr>::const_iterator anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
- std::shared_ptr<PlaneGCSSolver_PointWrapper> aWrapper =
+ std::shared_ptr<PlaneGCSSolver_PointWrapper> aWrapper =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(*anIt);
if (!aWrapper)
continue;
aNewEntity = EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(theFeature, aLine));
// sub-entities should not change their groups, therefore they are added later
- aNewEntity->setGroup(theGroupID);
+ aNewEntity->setGroup(theGroupID);
aNewEntity->setSubEntities(aSubs);
return aNewEntity;
}
aNewEntity = EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(theFeature, aCircle));
// sub-entities should not change their groups, therefore they are added later
- aNewEntity->setGroup(theGroupID);
+ aNewEntity->setGroup(theGroupID);
aNewEntity->setSubEntities(aSubs);
return aNewEntity;
}
std::shared_ptr<PlaneGCSSolver_PointWrapper> aCenterEnt, aStartEnt, aEndEnt;
std::list<EntityWrapperPtr>::const_iterator anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
- std::shared_ptr<PlaneGCSSolver_PointWrapper> aWrapper =
+ std::shared_ptr<PlaneGCSSolver_PointWrapper> aWrapper =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(*anIt);
if (!aWrapper)
continue;
aNewEntity = EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(theFeature, anArc));
// sub-entities should not change their groups, therefore they are added later
- aNewEntity->setGroup(theGroupID);
+ aNewEntity->setGroup(theGroupID);
aNewEntity->setSubEntities(aSubs);
return aNewEntity;
}
}
ConstraintWrapperPtr createConstraintPointOnEntity(
- ConstraintPtr theConstraint,
+ ConstraintPtr theConstraint,
const GroupID& theGroupID,
const SketchSolver_ConstraintType& theType,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
}
case ENTITY_ARC:
case ENTITY_CIRCLE: {
- std::shared_ptr<GCS::Circle> aCirc =
+ std::shared_ptr<GCS::Circle> aCirc =
std::dynamic_pointer_cast<GCS::Circle>(theEntity->entity());
aNewConstr = GCSConstraintPtr(
new GCS::ConstraintP2PDistance(*(thePoint->point()), aCirc->center, aCirc->rad));
std::shared_ptr<PlaneGCSSolver_ParameterWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
{
- std::shared_ptr<GCS::Circle> aCircle =
+ std::shared_ptr<GCS::Circle> aCircle =
std::dynamic_pointer_cast<GCS::Circle>(theEntity->entity());
GCSConstraintPtr aNewConstr(new GCS::ConstraintEqual(aCircle->rad, theValue->parameter()));
{
GCSConstraintPtr aNewConstr;
if (theType == CONSTRAINT_TANGENT_ARC_LINE || theType == CONSTRAINT_TANGENT_CIRCLE_LINE) {
- std::shared_ptr<GCS::Circle> aCirc =
+ std::shared_ptr<GCS::Circle> aCirc =
std::dynamic_pointer_cast<GCS::Circle>(theEntity1->entity());
- std::shared_ptr<GCS::Line> aLine =
+ std::shared_ptr<GCS::Line> aLine =
std::dynamic_pointer_cast<GCS::Line>(theEntity2->entity());
- aNewConstr =
+ aNewConstr =
GCSConstraintPtr(new GCS::ConstraintP2LDistance(aCirc->center, *aLine, aCirc->rad));
} else {
- std::shared_ptr<GCS::Circle> aCirc1 =
+ std::shared_ptr<GCS::Circle> aCirc1 =
std::dynamic_pointer_cast<GCS::Circle>(theEntity1->entity());
- std::shared_ptr<GCS::Circle> aCirc2 =
+ std::shared_ptr<GCS::Circle> aCirc2 =
std::dynamic_pointer_cast<GCS::Circle>(theEntity2->entity());
double aDX = *(aCirc1->center.x) - *(aCirc2->center.x);
(*aMIt)->setValue(aCoord[i]);
// update corresponding attribute
- AttributePtr anAttr =
+ AttributePtr anAttr =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(theMirrored)->baseAttribute();
if (anAttr) {
- std::shared_ptr<GeomDataAPI_Point2D> aMirroredPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aMirroredPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr);
aMirroredPnt->setValue(aCoord[0], aCoord[1]);
}
makeMirrorPoints(aPoints[0], aPoints[1], aMirrorLine);
// update scales of constraints
- std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> aGCSConstraint =
+ std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> aGCSConstraint =
std::dynamic_pointer_cast<PlaneGCSSolver_ConstraintWrapper>(theConstraint);
std::list<GCSConstraintPtr>::const_iterator aCIt = aGCSConstraint->constraints().begin();
for (; aCIt != aGCSConstraint->constraints().end(); ++aCIt)
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint
+ /// \param theValue [in] numeric characteristic of constraint
/// (e.g. distance or radius) if applicable
/// \param theEntity1 [in] first attribute of constraint
/// \param theEntity2 [in] second attribute of constraint
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
+ /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
/// if applicable
- /// \param theFullValue [in] indicates theValue shows full translation delta/rotation
+ /// \param theFullValue [in] indicates theValue shows full translation delta/rotation
/// angle or delta/angle between neighbor entities
/// \param thePoint1 [in] center for multi-rotation or start point for multi-translation
/// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation)
class PlaneGCSSolver_EntityWrapper : public SketchSolver_IEntityWrapper
{
public:
- PlaneGCSSolver_EntityWrapper(const FeaturePtr theFeature,
+ PlaneGCSSolver_EntityWrapper(const FeaturePtr theFeature,
const GCSCurvePtr theEntity = GCSCurvePtr());
/// \brief Return PlaneGCS geometric entity
GCS::VEC_I aRedundantID;
- // Workaround: the system with tangent constraint
+ // Workaround: the system with tangent constraint
// may fail if the tangent entities are connected smoothly.
// Investigate this situation and move constraints to redundant list
if (aResult == GCS::Failed && !myTangent.empty()) {
}
}
}
- // The system with tangent constraints may show redundant constraints
+ // The system with tangent constraints may show redundant constraints
// if the entities are coupled smoothly.
// Sometimes tangent constraints are fall to both conflicting and redundant constraints.
// Need to check if there are redundant constraints without these tangencies.
GCS::VEC_pD myParameters; ///< list of unknowns
/// list of constraints already processed by the system
- ConstraintMap myConstraints;
+ ConstraintMap myConstraints;
std::shared_ptr<GCS::System> myEquationSystem; ///< set of equations for solving in FreeGCS
GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints
/// specifies the conflicting constraints are already collected
- bool myConfCollected;
+ bool myConfCollected;
/// list of tangent IDs to check incorrect redundant constraints
GCS::SET_I myTangent;
std::list<EntityWrapperPtr>::const_iterator aSubIt = aSubs.begin();
while ((*aSubIt)->type() == ENTITY_POINT) // search scalar entities
++aSubIt;
- double* aStartAngle =
+ double* aStartAngle =
std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(*aSubIt++)->scalar();
double* aEndAngle =
std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(*aSubIt++)->scalar();
std::list<std::set<double*> >::iterator aCoincIt, aFound1, aFound2;
aFound1 = aFound2 = theCoincidentPoints.end();
- for (aCoincIt = theCoincidentPoints.begin();
+ for (aCoincIt = theCoincidentPoints.begin();
aCoincIt != theCoincidentPoints.end(); ++aCoincIt) {
if (aFound1 == theCoincidentPoints.end() && aCoincIt->find(aParams[0]) != aCoincIt->end())
aFound1 = aCoincIt;
{
if (!theAttribute)
return false;
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(theAttribute->owner());
return aSketchFeature.get() && aSketchFeature->isExternal();
}
std::list<ParameterWrapperPtr> aParams;
std::list<ParameterWrapperPtr>::const_iterator aParIt;
for (; anIt != myAttributeMap.end(); ++anIt) {
- // the external feature always should keep the up to date values, so,
+ // the external feature always should keep the up to date values, so,
// refresh from the solver is never needed
bool isExternal = isExternalAttribute(anIt->first);
theX = anArcPoint[0][0] + anArcPoint[2][0];
theY = anArcPoint[0][1] + anArcPoint[2][1];
} else {
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aStartDir(new GeomAPI_Dir2d(anArcPoint[1][0], anArcPoint[1][1]));
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aEndDir(new GeomAPI_Dir2d(anArcPoint[2][0], anArcPoint[2][1]));
double anAngle = aStartDir->angle(aEndDir);
if (anAngle < 0)
aParameters.push_back(aBuilder->createParameter(myGroupID, aMidPoint->y()));
// Create entity (parameters are not filled)
GCSPointPtr aPnt(new GCS::Point);
- aPnt->x =
+ aPnt->x =
std::dynamic_pointer_cast<PlaneGCSSolver_ParameterWrapper>(aParameters.front())->parameter();
- aPnt->y =
+ aPnt->y =
std::dynamic_pointer_cast<PlaneGCSSolver_ParameterWrapper>(aParameters.back())->parameter();
EntityWrapperPtr aResult(new PlaneGCSSolver_PointWrapper(AttributePtr(), aPnt));
/// additional constraints for correct processing of the arcs
std::map<EntityWrapperPtr, std::vector<GCSConstraintPtr> >
- myArcConstraintMap;
+ myArcConstraintMap;
/// list of removed constraints to notify solver
- std::list<GCSConstraintPtr> myRemovedConstraints;
+ std::list<GCSConstraintPtr> myRemovedConstraints;
};
#endif
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aRefAttr->object());
if (!aRC)
- Events_InfoMessage("SketchSolver_Builder",
+ Events_InfoMessage("SketchSolver_Builder",
SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this).send();
}
continue;
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aListIter);
if (*aListIter && !aRC)
- Events_InfoMessage("SketchSolver_Builder",
+ Events_InfoMessage("SketchSolver_Builder",
SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this).send();
}
}
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint
+ /// \param theValue [in] numeric characteristic of constraint
/// (e.g. distance or radius) if applicable
/// \param theEntity1 [in] first attribute of constraint
/// \param theEntity2 [in] second attribute of constraint
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
+ /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
/// if applicable
- /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or
+ /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or
/// delta/angle between neighbor entities
/// \param thePoint1 [in] center for multi-rotation or start point for multi-translation
/// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation)
/// \brief Check if two connected arcs have centers
/// in same direction relatively to connection point
- SKETCHSOLVER_EXPORT virtual bool isArcArcTangencyInternal(EntityWrapperPtr theArc1,
+ SKETCHSOLVER_EXPORT virtual bool isArcArcTangencyInternal(EntityWrapperPtr theArc1,
EntityWrapperPtr theArc2) const { return false; }
};
if ((*aCIt)->isUsed(theFeature))
return true;
- std::list<AttributePtr> anAttrList =
+ std::list<AttributePtr> anAttrList =
theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
std::list<AttributePtr>::const_iterator anAttrIt = anAttrList.begin();
for (; anAttrIt != anAttrList.end(); ++ anAttrIt)
SKETCHSOLVER_EXPORT virtual void update();
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another SketchPlugin constraints
+ /// \return \c false, if current constraint contains another SketchPlugin constraints
/// (like for multiple coincidence)
SKETCHSOLVER_EXPORT virtual bool remove();
virtual bool isUsed(AttributePtr theAttribute) const;
/// \brief Notify constraint, that coincidence appears or removed
- virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
+ virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
EntityWrapperPtr theCoincAttr2) { /* implement in derived class */ }
/// \brief Shows error message
ConstraintPtr myBaseConstraint; ///< base SketchPlugin constraint
/// storage, which contains all information about entities and constraints
- StoragePtr myStorage;
+ StoragePtr myStorage;
SketchSolver_ConstraintType myType; ///< type of constraint
std::list<EntityWrapperPtr> myAttributes; ///< attributes of constraint
virtual ~SketchSolver_ConstraintCollinear() {}
/// \brief Notify constraint, that coincidence appears or removed
- virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
+ virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
EntityWrapperPtr theCoincAttr2);
};
double myPrevValue; ///< previous value of distance (for correct calculation of a distance sign)
/// \c true, if the point if placed rightside of line direction (SLVS_C_PT_LINE_DISTANCE only)
- bool myIsNegative;
+ bool myIsNegative;
};
#endif
SketchSolver_ConstraintFixed(FeaturePtr theFeature);
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another
+ /// \return \c false, if current constraint contains another
/// SketchPlugin constraints (like for multiple coincidence)
virtual bool remove();
/// \brief Generate list of attributes of constraint in order useful for constraints
/// \param[out] theValue numerical characteristic of constraint (e.g. distance)
/// \param[out] theAttributes list of attributes to be filled
- virtual void getAttributes(ParameterWrapperPtr& theValue,
+ virtual void getAttributes(ParameterWrapperPtr& theValue,
std::vector<EntityWrapperPtr>& theAttributes);
/// \brief Fixed feature basing on its type
SketchSolver_ConstraintFixedArcRadius(FeaturePtr theFeature);
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another SketchPlugin constraints
+ /// \return \c false, if current constraint contains another SketchPlugin constraints
/// (like for multiple coincidence)
virtual bool remove();
std::vector<EntityWrapperPtr>& theAttributes)
{
SketchSolver_Constraint::getAttributes(theValue, theAttributes);
- if (!myErrorMsg.empty() || !theAttributes[2] ||
+ if (!myErrorMsg.empty() || !theAttributes[2] ||
theAttributes[2]->type() != ENTITY_LINE) {
theAttributes.clear();
return;
virtual ~SketchSolver_ConstraintMiddle() {}
/// \brief Notify constraint, that coincidence appears or removed
- virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
+ virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
EntityWrapperPtr theCoincAttr2);
};
std::list<EntityWrapperPtr> aMovedSubs = movedEntities(
*anOldIt, theOldStorage, *aNewIt, theNewStorage);
// check only the points to be moved (because arcs in PlaneGCS have scalar subs too)
- if ((*anOldIt)->type() == ENTITY_POINT &&
+ if ((*anOldIt)->type() == ENTITY_POINT &&
(aMovedSubs.size() != 1 || aMovedSubs.front() != *anOldIt))
isFullyMoved = false;
aMoved.insert(aMoved.end(), aMovedSubs.begin(), aMovedSubs.end());
{}
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another SketchPlugin
+ /// \return \c false, if current constraint contains another SketchPlugin
/// constraints (like for multiple coincidence)
virtual bool remove();
/// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
/// \param[out] theValue numerical characteristic of constraint (e.g. distance)
- /// \param[out] theAttributes list of attributes to be filled
+ /// \param[out] theAttributes list of attributes to be filled
/// (list of moved entities or attributes)
- virtual void getAttributes(ParameterWrapperPtr& theValue,
+ virtual void getAttributes(ParameterWrapperPtr& theValue,
std::vector<EntityWrapperPtr>& theAttributes);
private:
std::list<ObjectPtr> anObjectList = aRefList->list();
std::list<ObjectPtr>::iterator anObjIt = anObjectList.begin();
// execute for the feature is not called yet
- if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size())
+ if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size())
myNumberOfCopies = aRefList->size() / myNumberOfObjects - 1;
while (anObjIt != anObjectList.end()) {
continue;
// the entity is not created, so it is a copy in "multi" constraint, force its creation
- if (!myStorage->update(aFeature))
+ if (!myStorage->update(aFeature))
myStorage->update(aFeature, myGroupID, true);
theEntities.push_back(myStorage->entity(aFeature));
myFeatures.insert(aFeature);
AttributeIntegerPtr aNbObjects = myBaseConstraint->integer(nameNbObjects());
if (!anInitialRefList || !aNbObjects)
return; // the "Multi" constraint is in queue to remove
- bool isUpdated =
+ bool isUpdated =
anInitialRefList->size() != myNumberOfObjects || aNbObjects->value()-1 != myNumberOfCopies;
if (!isUpdated) {
// additional check that the features and their copies are changed
void update(bool isForce);
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another SketchPlugin
+ /// \return \c false, if current constraint contains another SketchPlugin
/// constraints (like for multiple coincidence)
virtual bool remove();
/// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
virtual const std::string& nameNbObjects() = 0;
-
+
protected:
/// \brief Convert absolute coordinates to relative coordinates
virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY) = 0;
bool myAdjusted; ///< the constraint is already adjusted (to not do it several times)
/// list of features and their copies to find whether some of them are disappeared
- std::set<FeaturePtr> myFeatures;
+ std::set<FeaturePtr> myFeatures;
};
#endif
for (; anEntIt != aBaseEntities.end(); ++anEntIt) {
std::list<ConstraintWrapperPtr> aNewConstraints =
aBuilder->createConstraint(myBaseConstraint, myGroupID, mySketchID, myType,
- myAngle, isFullValue, aRotationCenter, EntityWrapperPtr(),
+ myAngle, isFullValue, aRotationCenter, EntityWrapperPtr(),
std::list<EntityWrapperPtr>(1, *anEntIt));
aRotConstraints.insert(aRotConstraints.end(), aNewConstraints.begin(), aNewConstraints.end());
}
std::list<ConstraintWrapperPtr> aNewConstraints =
aBuilder->createConstraint(myBaseConstraint, myGroupID, mySketchID, myType,
0.0, aFullValue, aStartPoint, aEndPoint, std::list<EntityWrapperPtr>(1, *anEntIt));
- aTransConstraints.insert(aTransConstraints.end(),
+ aTransConstraints.insert(aTransConstraints.end(),
aNewConstraints.begin(), aNewConstraints.end());
}
aSLast = aConstraintEntities.end();
EntityWrapperPtr aStartEntity = *aSIt++;
if (aStartPointChanged) {
- AttributePtr aStartPointAttr =
+ AttributePtr aStartPointAttr =
aData->attribute(SketchPlugin_MultiTranslation::START_POINT_ID());
myStorage->update(aStartPointAttr);
aStartEntity = myStorage->entity(aStartPointAttr);
EntityWrapperPtr anEndEntity = *aSIt++;
if (anEndPointChanged) {
- AttributePtr anEndPointAttr =
+ AttributePtr anEndPointAttr =
aData->attribute(SketchPlugin_MultiTranslation::END_POINT_ID());
myStorage->update(anEndPointAttr);
anEndEntity = myStorage->entity(anEndPointAttr);
return;
}
- if (myType == CONSTRAINT_TANGENT_ARC_LINE &&
+ if (myType == CONSTRAINT_TANGENT_ARC_LINE &&
!hasSingleCoincidence(theAttributes[2], theAttributes[3]))
myErrorMsg = SketchSolver_Error::TANGENCY_FAILED();
/// Constraints should use objects instead of features as attributes
inline static const std::string& NEED_OBJECT_NOT_FEATURE()
{
- static const std::string
+ static const std::string
MY_ERROR_VALUE("Constraint should be based on object instead of feature");
return MY_ERROR_VALUE;
}
static const std::string MY_ERROR_VALUE("Entity already fixed");
return MY_ERROR_VALUE;
}
- /// Tangency constraint has been built with wrong attributes
+ /// Tangency constraint has been built with wrong attributes
/// (for example, line and arc have two coincident points)
inline static const std::string& TANGENCY_FAILED()
{
- static const std::string
+ static const std::string
MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
return MY_ERROR_VALUE;
}
return false;
}
// solution succeeded, store results into correspondent attributes
- if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET) {
+ if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET) {
myStorage->setNeedToResolve(false);
myStorage->refresh();
updateMultiConstraints(myConstraints);
// multi-constraints updated some parameters, need to store them
- if (myStorage->isNeedToResolve())
+ if (myStorage->isNeedToResolve())
resolveConstraints();
if (myPrevResult != STATUS_OK || myPrevResult == STATUS_UNKNOWN) {
// the error message should be changed before sending the message
getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())
->setValue(SketchSolver_Error::CONSTRAINTS());
- if (myPrevResult != aResult ||
- myPrevResult == STATUS_UNKNOWN ||
+ if (myPrevResult != aResult ||
+ myPrevResult == STATUS_UNKNOWN ||
myPrevResult == STATUS_FAILED) {
// Obtain list of conflicting constraints
std::set<ObjectPtr> aConflicting = myStorage->getConflictingConstraints(mySketchSolver);
// New storage will be used in trimmed way to store the list of constraint interacted together.
StoragePtr aNewStorage = SketchSolver_Manager::instance()->builder()->createStorage(getId());
// empty vector to avoid creation of solver's constraints
- std::list<ConstraintWrapperPtr> aDummyVec;
+ std::list<ConstraintWrapperPtr> aDummyVec;
// Obtain constraints, which should be separated
std::list<ConstraintPtr> anUnusedConstraints;
anUnusedConstraints.push_back(aCIter->first);
}
- // Check the unused constraints once again,
+ // Check the unused constraints once again,
// because they may become interacted with new storage since adding constraints
std::list<ConstraintPtr>::iterator aUnuseIt = anUnusedConstraints.begin();
while (aUnuseIt != anUnusedConstraints.end()) {
aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
if (anAttrA && anAttrB && (anAttrA->isObject() || anAttrB->isObject()))
// point-on-line and point-on-circle should go before points coincidence constraint
- return 2.0;
+ return 2.0;
return 2.5;
}
if (anID == SketchPlugin_ConstraintDistance::ID() ||
std::set<ObjectPtr>::const_iterator anObjIter = theObjects.begin();
for (; anObjIter != theObjects.end(); ++anObjIter) {
// Operate sketch itself and SketchPlugin features only.
- // Also, the Fillet and Split need to be skipped,
+ // Also, the Fillet and Split need to be skipped,
// because there are several separated constraints composing it.
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
if (!aFeature)
continue;
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if ((aFeature->getKind() != SketchPlugin_Sketch::ID() && !aSketchFeature) ||
aFeature->getKind() == SketchPlugin_ConstraintFillet::ID() ||
std::set<SolverConstraintPtr> myTempConstraints; ///< List of temporary constraints
/// List of parametric constraints
- std::map<AttributePtr, SolverConstraintPtr> myParametricConstraints;
+ std::map<AttributePtr, SolverConstraintPtr> myParametricConstraints;
StoragePtr myStorage; ///< Container for the set of SolveSpace constraints and their entities
SolverPtr mySketchSolver; ///< Solver for set of equations obtained by constraints
/// Result of previous solution of the set of constraints
- SketchSolver_SolveStatus myPrevResult;
+ SketchSolver_SolveStatus myPrevResult;
std::set<ObjectPtr> myConflictingConstraints; ///< List of conflicting constraints
};
const std::shared_ptr<Events_Message>& theMessage)
{
static const Events_ID aSketchPreparedEvent = Events_Loop::eventByName(EVENT_SKETCH_PREPARED);
- // sketch is prepared for resolve: all the needed events
+ // sketch is prepared for resolve: all the needed events
// are collected and must be processed by the solver
if (theMessage->eventID() == aSketchPreparedEvent) {
flushGrouped(anUpdateEvent);
if (isMovedEvt) {
std::set<ObjectPtr>::iterator aFeatIter;
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) {
- std::shared_ptr<SketchPlugin_Feature> aSFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
if (aSFeature && moveEntity(aSFeature)) {
// Want to avoid recalculation of DoF too frequently.
hasProperFeature = true;
}
}
- if (!hasProperFeature)
+ if (!hasProperFeature)
// in this iteration it will compute nothing, so, no problem with recursion
// it is important that solver flushes signal updated after processing move signal as there
// is optimization that relies on this update, might be found by key "optimization"
myIsComputed = false;
} else {
- std::list<FeaturePtr> aSketchFeatures =
+ std::list<FeaturePtr> aSketchFeatures =
SketchSolver_Group::selectApplicableFeatures(aFeatures);
std::list<FeaturePtr>::iterator aFeatIter = aSketchFeatures.begin();
for (; aFeatIter != aSketchFeatures.end(); ++aFeatIter) {
if ((*aFeatIter)->getKind() == SketchPlugin_Sketch::ID()) {
- std::shared_ptr<ModelAPI_CompositeFeature> aSketch =
+ std::shared_ptr<ModelAPI_CompositeFeature> aSketch =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aFeatIter);
hasProperFeature = changeWorkplane(aSketch) || hasProperFeature;
continue;
}
- std::shared_ptr<SketchPlugin_Feature> aFeature =
+ std::shared_ptr<SketchPlugin_Feature> aFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
if (!aFeature)
continue;
std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
- // Find SketchPlugin_Sketch::ID() in groups.
+ // Find SketchPlugin_Sketch::ID() in groups.
// The constraint groups should be updated when an object removed from Sketch
std::set<std::string>::const_iterator aFGrIter;
for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++)
myGroups.erase(aRemoveIt);
continue;
}
- if (!(*aGroupIter)->isConsistent()) {
+ if (!(*aGroupIter)->isConsistent()) {
// some constraints were removed, try to split the group
(*aGroupIter)->splitGroup(aSeparatedGroups);
if (!(*aGroupIter)->getWorkplane()->string(
std::set<GroupID> aGroups;
findGroups(theFeature, aGroups);
- std::shared_ptr<SketchPlugin_Constraint> aConstraint =
+ std::shared_ptr<SketchPlugin_Constraint> aConstraint =
std::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
// Process the groups list
return (*aGroupIter)->updateFeature(theFeature);
return (*aGroupIter)->changeConstraint(aConstraint);
}
- } else if (aGroups.size() > 1) {
+ } else if (aGroups.size() > 1) {
// Several groups applicable for this feature => need to merge them
std::set<GroupID>::const_iterator aGroupsIter = aGroups.begin();
bool SketchSolver_Manager::resolveConstraints(const std::list<SketchSolver_Group*>& theGroups)
{
bool needToUpdate = false;
- const std::list<SketchSolver_Group*>& aGroupsToResolve = theGroups.empty() ?
+ const std::list<SketchSolver_Group*>& aGroupsToResolve = theGroups.empty() ?
myGroups : theGroups;
std::list<SketchSolver_Group*>::const_iterator aGroupIter = aGroupsToResolve.begin();
for (; aGroupIter != aGroupsToResolve.end(); aGroupIter++)
// Obtain points and their copies for Mirror, Multi-Rotation and Multi-Translation constraints
-static void collectPointsAndCopies(FeaturePtr theConstraint,
+static void collectPointsAndCopies(FeaturePtr theConstraint,
std::list<std::set<AttributePtr> >& thePoints)
{
typedef std::list<std::string> strlist;
} else {
aDoF -= 1;
if (aCoincPoint[0] && aCoincLine) {
- // if the point is already coincident to a line
+ // if the point is already coincident to a line
// (by middle point constraint), do not decrease DoF
std::map<AttributePtr, std::set<FeaturePtr> >::iterator
aPtFound = aPointOnLine.find(aCoincPoint[0]);
if (isExternal(anAttr))
continue; // feature is already fixed since it is external
aDoF -= aDoFDelta[anAttr->getKind()];
- std::list<AttributePtr> aPtAttrs =
+ std::list<AttributePtr> aPtAttrs =
anAttr->data()->attributes(GeomDataAPI_Point2D::typeId());
aPoints.insert(aPtAttrs.begin(), aPtAttrs.end());
}
anAttrName = SketchPlugin_Constraint::ENTITY_B();
else {
if (aFeature->getKind() == SketchPlugin_MultiRotation::ID())
- aNbCopies =
+ aNbCopies =
aFeature->integer(SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID())->value() - 1;
else if (aFeature->getKind() == SketchPlugin_MultiTranslation::ID())
- aNbCopies =
+ aNbCopies =
aFeature->integer(SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID())->value() - 1;
anAttrName = SketchPlugin_Constraint::ENTITY_A();
}
* \return \c true, if groups are resolved, and features should be updated
* (send the Update event)
*/
- bool resolveConstraints(const std::list<SketchSolver_Group*>& theGroups =
+ bool resolveConstraints(const std::list<SketchSolver_Group*>& theGroups =
std::list<SketchSolver_Group*>());
private:
void SketchSolver_Storage::addEntity(AttributePtr theAttribute,
EntityWrapperPtr theSolverEntity)
{
- std::map<AttributePtr, EntityWrapperPtr>::const_iterator aFound =
+ std::map<AttributePtr, EntityWrapperPtr>::const_iterator aFound =
myAttributeMap.find(theAttribute);
if (aFound == myAttributeMap.end() || !aFound->second ||
(theSolverEntity && !aFound->second->isEqual(theSolverEntity)))
bool isUpdated = false;
EntityWrapperPtr aRelated = entity(theFeature);
if (!aRelated) { // Feature is not exist, create it
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
bool isCopy = isCopyInMulti(aSketchFeature, myConstraintMap);
// the feature is a copy in "Multi" constraint and does not used in other constraints
if (aFeature->getKind() == SketchPlugin_Arc::ID() &&
myFeatureMap.find(aFeature) == myFeatureMap.end()) {
// Additional checking that all attributes are initialized
- if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() &&
- aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() &&
+ if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() &&
+ aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() &&
aFeature->attribute(SketchPlugin_Arc::END_ID())->isInitialized()) {
return SketchSolver_Storage::update(aFeature, theGroup, theForce);
} else {
BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID;
// Check attribute of external features
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(anAttribute->owner());
- if (aSketchFeature && (aSketchFeature->isExternal() ||
+ if (aSketchFeature && (aSketchFeature->isExternal() ||
isCopyInMulti(aSketchFeature, myConstraintMap)))
aGroup = GID_OUTOFGROUP;
aRelated = aBuilder->createAttribute(anAttribute, aGroup);
return true;
}
-void SketchSolver_Storage::replaceEntities(const std::map<EntityWrapperPtr,
+void SketchSolver_Storage::replaceEntities(const std::map<EntityWrapperPtr,
EntityWrapperPtr>& theChange)
{
std::set<EntityWrapperPtr> anUpdFeatures;
if (aBaseFeature)
isFullyRemoved = SketchSolver_Storage::removeEntity(aBaseFeature) && isFullyRemoved;
else
- isFullyRemoved =
+ isFullyRemoved =
SketchSolver_Storage::removeEntity((*anIt)->baseAttribute()) && isFullyRemoved;
}
return isFullyRemoved;
if (!theAttribute)
return false;
- AttributeRefListPtr aRefList =
+ AttributeRefListPtr aRefList =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
if (aRefList) {
std::list<ObjectPtr> anObjects = aRefList->list();
return true;
}
- std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator aCIt =
+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator aCIt =
myConstraintMap.begin();
std::list<ConstraintWrapperPtr>::const_iterator aCWIt;
for (; aCIt != myConstraintMap.end(); ++aCIt) {
for (; aFIt != myFeatureMap.end(); ++aFIt)
if (!aFIt->second && aFIt->first->getKind() == SketchPlugin_Arc::ID()) {
// Additional checking the attributes are initialized
- if (aFIt->first->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() &&
- aFIt->first->attribute(SketchPlugin_Arc::START_ID())->isInitialized() &&
+ if (aFIt->first->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() &&
+ aFIt->first->attribute(SketchPlugin_Arc::START_ID())->isInitialized() &&
aFIt->first->attribute(SketchPlugin_Arc::END_ID())->isInitialized())
update(aFIt->first);
else
// if the feature has several results, we choose which one is referred
const std::list<ResultPtr>& aResults = aFeature->results();
if (aResults.size() > 1 && theResult != aFeature->lastResult()) {
- // actually, the attribute refers to center of arc or circle,
+ // actually, the attribute refers to center of arc or circle,
// but not the edge, get correct attributes
std::string anAttrName;
if (aFeature->getKind() == SketchPlugin_Arc::ID())
/// \param theGroup [in] id of the group where the feature should be placed
/// \param theForce [in] forced feature creation
/// \return \c true if the feature has been created or updated
- SKETCHSOLVER_EXPORT bool update(FeaturePtr theFeature,
+ SKETCHSOLVER_EXPORT bool update(FeaturePtr theFeature,
const GroupID& theGroup = GID_UNKNOWN, bool theForce = false);
/// \brief Convert attribute to the form applicable for specific solver and map it
/// \param theGroup [in] id of the group where the feature should be placed
/// \param theForce [in] forced feature creation
/// \return \c true if the attribute has been created or updated
- SKETCHSOLVER_EXPORT bool update(AttributePtr theAttribute,
+ SKETCHSOLVER_EXPORT bool update(AttributePtr theAttribute,
const GroupID& theGroup = GID_UNKNOWN, bool theForce = false);
/// \brief Returns constraint related to corresponding constraint
void addEntity(FeaturePtr theFeature,
EntityWrapperPtr theSolverEntity);
- /// \brief Change mapping attribute of a feature and the entity
+ /// \brief Change mapping attribute of a feature and the entity
/// applicable for corresponding solver.
/// \param theAttribute [in] original attribute
/// \param theSolverEntity [in] solver's entity, created outside
std::map<AttributePtr, EntityWrapperPtr> myAttributeMap;
/// lists of coincident points (first is a master point, second is a set of slaves)
- CoincidentPointsMap myCoincidentPoints;
+ CoincidentPointsMap myCoincidentPoints;
// to be able to update entities from constraints
friend class SketchSolver_ConstraintDistance;
aSlvsEntities[i] = (Slvs_hEntity)anOriginal[i]->id();
// entity is not added into a storage, constraint can not be created
if (aSlvsEntities[i] == SLVS_E_UNKNOWN)
- return std::list<ConstraintWrapperPtr>();
+ return std::list<ConstraintWrapperPtr>();
aConstrAttrList.push_back(anOriginal[i]);
}
aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end());
}
else if (theEntity1->type() == ENTITY_ARC) {
- // Do not allow mirrored arc recalculate its position until
+ // Do not allow mirrored arc recalculate its position until
// coordinated of all points recalculated
FeaturePtr aMirrArc = theEntity2->baseFeature();
aMirrArc->data()->blockSendAttributeUpdated(true);
anIt1 = aBaseArcPoints.begin();
anIt2 = aMirrorArcPoints.begin();
for (; anIt1 != aBaseArcPoints.end(); ++anIt1, ++anIt2) {
- aMrrList =
+ aMrrList =
createMirror(theConstraint, theGroupID, theSketchID, *anIt1, *anIt2, theMirrorLine);
aResult.insert(aResult.end(), aMrrList.begin(), aMrrList.end());
}
else if (aFeatureKind == SketchPlugin_Arc::ID())
return createArc(theFeature, theAttributes, theGroupID, theSketchID);
// Point (it has low probability to be an attribute of constraint, so it is checked at the end)
- else if (aFeatureKind == SketchPlugin_Point::ID() ||
+ else if (aFeatureKind == SketchPlugin_Point::ID() ||
aFeatureKind == SketchPlugin_IntersectionPoint::ID()) {
AttributePtr aPoint = theFeature->attribute(SketchPlugin_Point::COORD_ID());
if (!aPoint->isInitialized())
return aDummy;
- EntityWrapperPtr aSub = theAttributes.empty() ?
+ EntityWrapperPtr aSub = theAttributes.empty() ?
createAttribute(aPoint, theGroupID, theSketchID) :
theAttributes.front();
if (!aSub)
std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (aPoint2D) {
- aParameters.push_back(createParameter(theGroupID, aPoint2D->x(),
+ aParameters.push_back(createParameter(theGroupID, aPoint2D->x(),
!aPoint2D->textX().empty()));
- aParameters.push_back(createParameter(theGroupID, aPoint2D->y(),
+ aParameters.push_back(createParameter(theGroupID, aPoint2D->y(),
!aPoint2D->textY().empty()));
// Create entity (parameters are not filled)
anEntity = Slvs_MakePoint2d(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID,
AttributeDoublePtr aScalar =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
if (aScalar) {
- aParameters.push_back(createParameter(theGroupID, aScalar->value(),
+ aParameters.push_back(createParameter(theGroupID, aScalar->value(),
!aScalar->text().empty()));
// Create entity (parameter is not filled)
anEntity = Slvs_MakeDistance(SLVS_E_UNKNOWN, (Slvs_hGroup)theGroupID,
std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(theNormal);
std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirX);
if (!aDirX || !aNorm ||
- (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance) ||
+ (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance) ||
!aNorm->isInitialized())
return EntityWrapperPtr();
// calculate Y direction
EntityWrapperPtr aStartEnt, aEndEnt;
std::list<EntityWrapperPtr>::const_iterator anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(*anIt);
if (aSlvsEntity->isBase(aStart))
aStartEnt = aSlvsEntity;
EntityWrapperPtr aCenterEnt, aRadiusEnt, aNormalEnt;
std::list<EntityWrapperPtr>::const_iterator anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(*anIt);
if (aSlvsEntity->isBase(aCenter))
aCenterEnt = aSlvsEntity;
EntityWrapperPtr aCenterEnt, aStartEnt, aEndEnt, aNormalEnt;
std::list<EntityWrapperPtr>::const_iterator anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> aSlvsEntity =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(*anIt);
if (aSlvsEntity->isBase(aCenter))
aCenterEnt = aSlvsEntity;
aConstraint->baseConstraint()->boolean(
SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value()
};
- std::shared_ptr<GeomAPI_Angle2d>
+ std::shared_ptr<GeomAPI_Angle2d>
anAngle(new GeomAPI_Angle2d(aLine[0], isReversed[0], aLine[1], isReversed[1]));
std::shared_ptr<GeomAPI_Pnt2d> aCenter = anAngle->center();
(*aMIt)->setValue(aCoord[i]);
// update corresponding attribute
- AttributePtr anAttr =
+ AttributePtr anAttr =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theMirrored)->baseAttribute();
if (anAttr) {
- std::shared_ptr<GeomDataAPI_Point2D> aMirroredPnt =
+ std::shared_ptr<GeomDataAPI_Point2D> aMirroredPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr);
aMirroredPnt->setValue(aCoord[0], aCoord[1]);
}
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint
+ /// \param theValue [in] numeric characteristic of constraint
/// (e.g. distance or radius) if applicable
/// \param theEntity1 [in] first attribute of constraint
/// \param theEntity2 [in] second attribute of constraint
/// \param theGroupID [in] group the constraint belongs to
/// \param theSketchID [in] sketch the constraint belongs to
/// \param theType [in] type of constraint
- /// \param theValue [in] numeric characteristic of constraint
+ /// \param theValue [in] numeric characteristic of constraint
/// (angle for multi-rotation) if applicable
- /// \param theFullValue [in] indicates theValue shows full translation
+ /// \param theFullValue [in] indicates theValue shows full translation
/// delta/rotation angle or delta/angle between neighbor entities
/// \param thePoint1 [in] center for multi-rotation or start point for multi-translation
/// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation)
bool SolveSpaceSolver_ConstraintWrapper::isEqual(const ConstraintWrapperPtr& theOther)
{
- const Slvs_Constraint anOtherConstraint =
+ const Slvs_Constraint anOtherConstraint =
std::dynamic_pointer_cast<SolveSpaceSolver_ConstraintWrapper>(theOther)->constraint();
if (mySlvsConstraint.type != anOtherConstraint.type)
return false;
bool SolveSpaceSolver_ParameterWrapper::isEqual(const ParameterWrapperPtr& theOther)
{
- std::shared_ptr<SolveSpaceSolver_ParameterWrapper> anOtherParam =
+ std::shared_ptr<SolveSpaceSolver_ParameterWrapper> anOtherParam =
std::dynamic_pointer_cast<SolveSpaceSolver_ParameterWrapper>(theOther);
return anOtherParam && fabs(value() - anOtherParam->value()) < tolerance;
}
#include <SketchSolver_ISolver.h>
-// Need to be defined before including SolveSpace to avoid additional
+// Need to be defined before including SolveSpace to avoid additional
// dependences on Windows platform
#if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
typedef unsigned int UINT32;
/// \brief Compare two entities to be different
static bool IsNotEqual(const Slvs_Entity& theEntity1, const Slvs_Entity& theEntity2);
/// \brief Compare two constraints to be different
-static bool IsNotEqual(const Slvs_Constraint& theConstraint1,
+static bool IsNotEqual(const Slvs_Constraint& theConstraint1,
const Slvs_Constraint& theConstraint2);
bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity)
{
bool isUpdated = false;
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> anEntity =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> anEntity =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theEntity);
Slvs_Entity aSlvsEnt = getEntity((Slvs_hEntity)anEntity->id());
if (aSlvsEnt.h == SLVS_E_UNKNOWN)
bool SolveSpaceSolver_Storage::update(ParameterWrapperPtr theParameter)
{
- std::shared_ptr<SolveSpaceSolver_ParameterWrapper> aParameter =
+ std::shared_ptr<SolveSpaceSolver_ParameterWrapper> aParameter =
std::dynamic_pointer_cast<SolveSpaceSolver_ParameterWrapper>(theParameter);
const Slvs_Param& aParam = getParameter((Slvs_hParam)aParameter->id());
if (aParam.h != SLVS_E_UNKNOWN && fabs(aParam.val - aParameter->value()) < tolerance)
return false;
Slvs_Param aParamToUpd = aParameter->parameter();
if (aParamToUpd.group == SLVS_G_UNKNOWN)
- aParamToUpd.group = aParameter->isParametric() ? (Slvs_hGroup)GID_OUTOFGROUP :
+ aParamToUpd.group = aParameter->isParametric() ? (Slvs_hGroup)GID_OUTOFGROUP :
(Slvs_hGroup)myGroupID;
Slvs_hParam anID = updateParameter(aParamToUpd);
if (aParam.h == SLVS_E_UNKNOWN) // new parameter
if (theMaster->id() != theSlave->id())
removeEntity((Slvs_hEntity)theSlave->id());
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> aPointMaster =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> aPointMaster =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theMaster);
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> aPointSlave =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> aPointSlave =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theSlave);
aPointSlave->changeEntity() = aPointMaster->entity();
aPointSlave->setParameters(aPointMaster->parameters());
addSameConstraints(*aCIt2, aWrapper);
break;
}
- } else
+ } else
aConstr.h = updateConstraint(aConstr);
aWrapper->changeConstraint() = aConstr;
theX = anArcPoint[0][0] + anArcPoint[2][0];
theY = anArcPoint[0][1] + anArcPoint[2][1];
} else {
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aStartDir(new GeomAPI_Dir2d(anArcPoint[1][0], anArcPoint[1][1]));
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aEndDir(new GeomAPI_Dir2d(anArcPoint[2][0], anArcPoint[2][1]));
double anAngle = aStartDir->angle(aEndDir);
if (anAngle < 0)
Slvs_Entity aNewLine2 = Slvs_MakeLineSegment(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID,
myWorkplaneID, aLine.point[1], aConstraint.ptA);
aNewLine2.h = addEntity(aNewLine2);
- aConstraint = Slvs_MakeConstraint(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID,
+ aConstraint = Slvs_MakeConstraint(SLVS_E_UNKNOWN, (Slvs_hGroup)myGroupID,
SLVS_C_EQUAL_LENGTH_LINES,
myWorkplaneID, 0.0, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aNewLine1.h, aNewLine2.h);
}
}
}
- std::shared_ptr<SolveSpaceSolver_EntityWrapper> anEntity =
+ std::shared_ptr<SolveSpaceSolver_EntityWrapper> anEntity =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theEntity);
bool isFullyRemoved = isCoincide ? true : removeEntity((Slvs_hEntity)anEntity->id());
return (SketchSolver_Storage::remove(theEntity) || isCoincide) && isFullyRemoved;
for (; anIt != myAttributeMap.end(); ++anIt) {
if (!anIt->second)
continue;
- // the external feature always should keep the up to date values, so,
+ // the external feature always should keep the up to date values, so,
// refresh from the solver is never needed
if (anIt->first.get()) {
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(anIt->first->owner());
if (aSketchFeature.get() && aSketchFeature->isExternal())
continue;
bool isUpd[3] = {false};
int i = 0;
for (aParIt = aParams.begin(); i < 3 && aParIt != aParams.end(); ++aParIt, ++i) {
- std::shared_ptr<SolveSpaceSolver_ParameterWrapper> aWrapper =
+ std::shared_ptr<SolveSpaceSolver_ParameterWrapper> aWrapper =
std::dynamic_pointer_cast<SolveSpaceSolver_ParameterWrapper>(*aParIt);
if (!theFixedOnly || aWrapper->group() == GID_OUTOFGROUP || aWrapper->isParametric()) {
aWrapper->changeParameter().val = getParameter((Slvs_hParam)aWrapper->id()).val;
aPoint2D->setValue(aCoords[0], aCoords[1]);
// Find points coincident with this one (probably not in GID_OUTOFGROUP)
std::map<AttributePtr, EntityWrapperPtr>::const_iterator aLocIt;
- if (theFixedOnly)
+ if (theFixedOnly)
aLocIt = myAttributeMap.begin();
else {
aLocIt = anIt;
for (; aLocIt != myAttributeMap.end(); ++aLocIt) {
if (!aLocIt->second)
continue;
- std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aLocIt->first->owner());
if (aSketchFeature && aSketchFeature->isExternal())
continue;
if (i > 0) {
anArcPoints[i][0] -= anArcPoints[0][0];
anArcPoints[i][1] -= anArcPoints[0][1];
- aDist[i] = sqrt(anArcPoints[i][0] * anArcPoints[i][0] +
+ aDist[i] = sqrt(anArcPoints[i][0] * anArcPoints[i][0] +
anArcPoints[i][1] * anArcPoints[i][1]);
}
}
///
/// These constraints may be different and become the same after the substitution
/// of point coincidence.
- void addSameConstraints(ConstraintWrapperPtr theConstraint1,
+ void addSameConstraints(ConstraintWrapperPtr theConstraint1,
ConstraintWrapperPtr theConstraint2);
/// \brief Search constraint equal to the given in terms of SolveSpace notation
Slvs_hEntity myWorkplaneID; ///< identifier of workplane
/// current parameter index (may differs with the number of parameters)
- Slvs_hParam myParamMaxID;
+ Slvs_hParam myParamMaxID;
/// list of parameters used in the current group of constraints (sorted by the identifier)
- std::vector<Slvs_Param> myParameters;
+ std::vector<Slvs_Param> myParameters;
Slvs_hEntity myEntityMaxID; ///< current entity index (may differs with the number of entities)
/// list of entities used in the current group of constraints (sorted by the identifier)
- std::vector<Slvs_Entity> myEntities;
+ std::vector<Slvs_Entity> myEntities;
/// current constraint index (may differs with the number of constraints)
- Slvs_hConstraint myConstrMaxID;
+ Slvs_hConstraint myConstrMaxID;
/// list of constraints used in the current group (sorted by the identifier)
- std::vector<Slvs_Constraint> myConstraints;
+ std::vector<Slvs_Constraint> myConstraints;
bool myDuplicatedConstraint; ///< shows the storage has same constraint twice
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension);
-SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
+SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint),
mySketcherPlane(thePlane),
myAspect->MakeUnitsDisplayed(false);
myAspect->TextAspect()->SetHeight(SketcherPrs_Tools::getDefaultTextHeight());
myAspect->ArrowAspect()->SetLength(SketcherPrs_Tools::getArrowSize());
-
+
SetDimensionAspect(myAspect);
myStyleListener = new SketcherPrs_DimensionStyleListener();
DataPtr aData = theConstraint->data();
// Flyout point
- std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
if (!aFlyoutAttr->isInitialized())
if (!anAttr2->isInitialized())
return aReadyToDisplay;
- FeaturePtr aLineA =
+ FeaturePtr aLineA =
SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
- FeaturePtr aLineB =
+ FeaturePtr aLineB =
SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
if (!aLineA.get() || !aLineB.get())
aStartA->pnt(), aEndA->pnt(), aStartB->pnt(), aEndB->pnt()));
else {
std::shared_ptr<GeomAPI_Lin2d> aLine1(new GeomAPI_Lin2d(aStartA->pnt(), aEndA->pnt()));
- bool isReversed1 =
+ bool isReversed1 =
aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->value();
std::shared_ptr<GeomAPI_Lin2d> aLine2(new GeomAPI_Lin2d(aStartB->pnt(), aEndB->pnt()));
- bool isReversed2 =
+ bool isReversed2 =
aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value();
anAng = std::shared_ptr<GeomAPI_Angle2d>(
new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2));
void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint;
- bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane,
+ bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane,
aFirstPoint, aSecondPoint, aCenterPoint);
if (aReadyToDisplay) {
myFirstPoint = aFirstPoint;
myCenterPoint = aCenterPoint;
DataPtr aData = myConstraint->data();
- AttributeDoublePtr anAttributeValue =
+ AttributeDoublePtr anAttributeValue =
aData->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID());
myValue.init(anAttributeValue);
- std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt =
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt =
mySketcherPlane->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
myFlyOutPoint = aFlyoutPnt->impl<gp_Pnt>();
}
default: {
// there are own selection modes, so the others should be ignored
// otherwise, the text selection appears in the viewer
- return;
+ return;
}
}
SetSelToleranceForText2d(SketcherPrs_Tools::getTextHeight());
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
/// Destructor
DEFINE_STANDARD_RTTI(SketcherPrs_Angle)
- /// Returns true if the constraint feature arguments are correcly filled
+ /// Returns true if the constraint feature arguments are correcly filled
/// to build AIS presentation
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject);
-SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_InteractiveObject(), myConstraint(theConstraint), mySketcherPlane(thePlane),
myPoint(gp_Pnt(0.0, 0.0, 0.0)), myIsConflicting(false)
{
void SketcherPrs_Coincident::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
gp_Pnt aPoint;
/// Constructor
/// \param theConstraint a constraint object
/// \param thePlane plane of a sketch
- Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
/// Defines color for the presentation
/// \param aColor a color object
Standard_EXPORT virtual void SetColor(const Quantity_Color& aColor);
-
+
/// Defines color for the presentation
/// \param aColor a color name
Standard_EXPORT virtual void SetColor(const Quantity_NameOfColor aColor);
/// Set state of the presentation, in case of conflicting state, the icon of the presentation is
- /// visualized in error color.
+ /// visualized in error color.
/// The state is stored in an internal field, so should be changed when
/// constraint become not conflicting
/// \param theConflicting a state
/// \param theColor a color for conflicting object
- Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting,
+ Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting,
const std::vector<int>& theColor);
/// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
myPntArray = new Graphic3d_ArrayOfPoints(2);
myPntArray->AddVertex(0., 0., 0.);
myPntArray->AddVertex(0., 0., 0.);
-}
+}
bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
// Set points of the presentation
return true;
}
-void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Collinear)
aCustomValue = theTextValue.c_str();
else {
// format value string using "sprintf"
- TCollection_AsciiString aFormatStr =
+ TCollection_AsciiString aFormatStr =
theDimension->Attributes()->DimensionAspect()->ValueStringFormat();
char aFmtBuffer[256];
sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue);
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
myPntArray = new Graphic3d_ArrayOfPoints(2);
myPntArray->AddVertex(0., 0., 0.);
myPntArray->AddVertex(0., 0., 0.);
-}
+}
bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
{
bool aReadyToDisplay = false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
// Set points of the presentation
return true;
}
-void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Equal)
anAISObj = thePrevious;
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
- Handle(SketcherPrs_HVDirection) aPrs =
+ Handle(SketcherPrs_HVDirection) aPrs =
new SketcherPrs_HVDirection(theConstraint, thePlane, true);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
-{
+{
std::shared_ptr<GeomAPI_AISObject> anAISObj;
if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, thePlane)) {
if (thePrevious.get())
anAISObj = thePrevious;
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
- Handle(SketcherPrs_HVDirection) aPrs =
+ Handle(SketcherPrs_HVDirection) aPrs =
new SketcherPrs_HVDirection(theConstraint, thePlane, false);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
-{
+{
std::shared_ptr<GeomAPI_AISObject> anAISObj;
if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, thePlane)) {
if (thePrevious.get())
anAISObj = thePrevious;
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
- Handle(SketcherPrs_Transformation) aPrs =
- new SketcherPrs_Transformation(theConstraint, thePlane, true);
+ Handle(SketcherPrs_Transformation) aPrs =
+ new SketcherPrs_Transformation(theConstraint, thePlane, true);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
-{
+{
std::shared_ptr<GeomAPI_AISObject> anAISObj;
if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, thePlane)) {
if (thePrevious.get())
anAISObj = thePrevious;
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
- Handle(SketcherPrs_Transformation) aPrs =
- new SketcherPrs_Transformation(theConstraint, thePlane, false);
+ Handle(SketcherPrs_Transformation) aPrs =
+ new SketcherPrs_Transformation(theConstraint, thePlane, false);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
- bool isHorisontal)
+ bool isHorisontal)
: SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
{
}
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
{
bool aReadyToDisplay = false;
- ObjectPtr aObj =
+ ObjectPtr aObj =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL;
return aReadyToDisplay;
}
-bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
return true;
}
-void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
// Draw constrained object
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
/// \param isHorisontal a flag horizontal or vertical presentation
- Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isHorisontal);
void SketcherPrs_LengthDimension::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
gp_Pnt aPnt1, aPnt2;
DataPtr aData = theConstraint->data();
if (theConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) {
// The constraint is length
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>
(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
if (!anAttr)
// Get geometry of the object
DataPtr aLineData = aFeature->data();
- std::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aLineData->attribute(SketchPlugin_Line::START_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aEndPoint =
+ std::shared_ptr<GeomDataAPI_Point2D> aEndPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aLineData->attribute(SketchPlugin_Line::END_ID()));
thePnt1 = thePlane->to3D(aStartPoint->x(), aStartPoint->y())->impl<gp_Pnt>();
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
/// Destructor
DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension)
- /// Returns true if the constraint feature arguments are correcly filled
+ /// Returns true if the constraint feature arguments are correcly filled
/// to build AIS presentation
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
/// Redefinition of virtual function
Standard_EXPORT virtual void Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode = 0);
/// Redefinition of virtual function
/// Listener to update dimension visualization style
SketcherPrs_DimensionStyleListener* myStyleListener;
- /// container of values obtained from the constraint, which are necessary
+ /// container of values obtained from the constraint, which are necessary
/// to fill the presentation
gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry
gp_Pnt mySecondPoint; ///< the dimension first point for measured geometry
double myDistance; ///< the flyout distance
/// the structure filled by constraint
- SketcherPrs_DimensionStyleListener::DimensionValue myValue;
+ SketcherPrs_DimensionStyleListener::DimensionValue myValue;
};
#endif
\ No newline at end of file
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
}
{
bool aReadyToDisplay = false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
// one object is a feature Line, other object is a point result. We check shape of point result
ObjectPtr aPointObject;
// find a line result to set middle symbol near it
- AttributePtr anAttribute =
+ AttributePtr anAttribute =
SketcherPrs_Tools::getAttribute(myConstraint, SketchPlugin_Constraint::ENTITY_A());
if (!anAttribute.get()) {
- ObjectPtr aObj =
+ ObjectPtr aObj =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
if (aShape.get() && aShape->isEdge())
aPointObject = aObj;
}
if (!aPointObject.get()) {
- ObjectPtr aObj =
+ ObjectPtr aObj =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
if (aShape.get() && aShape->isEdge())
return true;
}
-void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
// Draw objects
- ObjectPtr aObject =
+ ObjectPtr aObject =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
drawLine(thePrs, theColor, aObject);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Middle)
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
-}
+}
bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
bool aReadyToDisplay = false;
// Get axis of mirror
- ObjectPtr aAxisObj =
+ ObjectPtr aAxisObj =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
if (SketcherPrs_Tools::getShape(aAxisObj).get() == NULL)
return aReadyToDisplay;
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
// Get source objects
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
if (anAttrB.get() == NULL)
return aReadyToDisplay;
// Get mirrored objects
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
aData->reflist(SketchPlugin_Constraint::ENTITY_C());
if (anAttrC.get() == NULL)
return aReadyToDisplay;
return false;
// Get axis of mirror
- ObjectPtr aAxisObj =
+ ObjectPtr aAxisObj =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
// Get source objects
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
// Get mirrored objects
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
aData->reflist(SketchPlugin_Constraint::ENTITY_C());
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
- }
+ }
// Get position of each mirrored object
for (i = 0; i < aNb; i++) {
aObj = anAttrC->object(i);
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(aNb + i + 1, aP1);
- }
+ }
return true;
}
-void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
if (anAttrB.get() == NULL)
return;
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
aData->reflist(SketchPlugin_Constraint::ENTITY_C());
if (anAttrC.get() == NULL)
return;
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Mirror)
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
// Create default array
myPntArray = new Graphic3d_ArrayOfPoints(2);
myPntArray->AddVertex(0., 0., 0.);
myPntArray->AddVertex(0., 0., 0.);
-}
+}
bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
{
bool aReadyToDisplay = false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
// Compute position of symbols
}
-void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Parallel)
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
myPntArray = new Graphic3d_ArrayOfPoints(2);
myPntArray->AddVertex(0., 0., 0.);
myPntArray->AddVertex(0., 0., 0.);
-}
+}
bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
{
bool aReadyToDisplay = false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
// Compute position of symbols
}
-void SketcherPrs_Perpendicular::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Perpendicular::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Perpendicular)
// The class is implemented as a singlton
SketcherPrs_PositionMgr* SketcherPrs_PositionMgr::get()
{
- if (MyPosMgr == NULL)
+ if (MyPosMgr == NULL)
MyPosMgr = new SketcherPrs_PositionMgr();
return MyPosMgr;
}
}
-int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine,
+int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine,
const SketcherPrs_SymbolPrs* thePrs)
{
if (myShapes.count(theLine) == 1) {
}
}
-gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape,
+gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape,
const SketcherPrs_SymbolPrs* thePrs,
double theStep)
{
gp_Pnt aP; // Central point
gp_Vec aVec1; // main vector
if (aShape->isEdge()) {
- std::shared_ptr<GeomAPI_Curve> aCurve =
+ std::shared_ptr<GeomAPI_Curve> aCurve =
std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShape));
std::shared_ptr<GeomAPI_Pnt> aPnt1; // Start point of main vector
std::shared_ptr<GeomAPI_Pnt> aPnt2; // End point of main vector
if (aCurve->isLine()) {
- std::shared_ptr<GeomAPI_Edge> aEdge =
+ std::shared_ptr<GeomAPI_Edge> aEdge =
std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aShape));
aPnt1 = aEdge->firstPoint();
aVec1 = gp_Vec(aPnt1->impl<gp_Pnt>(), aPnt2->impl<gp_Pnt>());
} else {
// This is a point
- std::shared_ptr<GeomAPI_Vertex> aVertex =
+ std::shared_ptr<GeomAPI_Vertex> aVertex =
std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(aShape));
std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
aP = aPnt->impl<gp_Pnt>();
// Even position
aP.Translate(aShift);
if (aPos > 0) {
- if (aPos % 4 == 0)
+ if (aPos % 4 == 0)
aM = aPos / 4;
else
aM = -(aPos + 2) / 4;
// Odd position
aP.Translate(-aShift);
if (aPos > 1) {
- if ((aPos - 1) % 4 == 0)
+ if ((aPos - 1) % 4 == 0)
aM = (aPos - 1) / 4;
else
aM = -(aPos + 1) / 4;
static SketcherPrs_PositionMgr* get();
/// Returns position of symbol for the given presentation
- /// \param theLine constrained object
+ /// \param theLine constrained object
/// \param thePrs a presentation of constraint
/// \param theStep step between symbols
gp_Pnt getPosition(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs, double theStep = 20);
SketcherPrs_PositionMgr();
/// Returns position index of the given constraint
- /// \param theLine constrained object
+ /// \param theLine constrained object
/// \param thePrs a presentation of constraint
int getPositionIndex(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs);
/// The map which contains position of presentation
PositionsMap myIndexes;
- /// The map contains position index
+ /// The map contains position index
std::map<ObjectPtr, PositionsMap> myShapes;
};
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
-SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
+SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), mySketcherPlane(thePlane),
myCircle(MyDefCirc),
DataPtr aData = theConstraint->data();
// Flyout point
- std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
if (!aFlyoutAttr->isInitialized()) {
}
// Get circle
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>
(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
if (!anAttr)
if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle
aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
- AttributeDoublePtr aCircRadius =
+ AttributeDoublePtr aCircRadius =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aCyrcFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
aRadius = aCircRadius->value();
} else { // arc
aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aCyrcFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
- //std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
+ //std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
// std::dynamic_pointer_cast<GeomDataAPI_Point2D>
// (aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
//theRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
- AttributeDoublePtr aCircRadius =
+ AttributeDoublePtr aCircRadius =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aCyrcFeature->data()->attribute(SketchPlugin_Arc::RADIUS_ID()));
aRadius = aCircRadius->value();
std::shared_ptr<GeomAPI_Dir> aNormal = thePlane->normal();
GeomAPI_Circ aCircle(aCenter, aNormal, aRadius);
- std::shared_ptr<GeomAPI_Pnt> anAnchor =
+ std::shared_ptr<GeomAPI_Pnt> anAnchor =
SketcherPrs_Tools::getAnchorPoint(theConstraint, thePlane);
theCircle = aCircle.impl<gp_Circ>();
void SketcherPrs_Radius::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
gp_Circ aCircle;
GetValueString(aTextSize);
SketcherPrs_Tools::updateArrows(DimensionAspect(), GetValue(), aTextSize);
-
+
AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
if (!aReadyToDisplay)
default: {
// there are own selection modes, so the others should be ignored
// otherwise, the text selection appears in the viewer
- return;
+ return;
}
}
SetSelToleranceForText2d(SketcherPrs_Tools::getTextHeight());
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
/// Destructor
DEFINE_STANDARD_RTTI(SketcherPrs_Radius)
- /// Returns true if the constraint feature arguments are correcly filled
+ /// Returns true if the constraint feature arguments are correcly filled
/// to build AIS presentation
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Rigid, SketcherPrs_SymbolPrs);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Rigid, SketcherPrs_SymbolPrs);
-static Handle(Image_AlienPixMap) MyPixMap;
+static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
}
bool aReadyToDisplay = false;
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
aData->refattr(SketchPlugin_Constraint::ENTITY_A());
AttributePtr aRefAttr = anAttr->attr();
if (anAttr->isObject()) {
return aReadyToDisplay;
}
-bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
aData->refattr(SketchPlugin_Constraint::ENTITY_A());
AttributePtr aRefAttr = anAttr->attr();
if (anAttr->isObject()) {
}
-void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
return;
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
*/
class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity
{
-public:
+public:
//! Constructs a sensitive point object defined by the
//! \param OwnerId an Id of the Owner.
//! \param theId and Id of its point
Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId,
int theId);
-
+
/// Returns number of sub-elements
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(SketcherPrs_SensitivePoint)
-private:
+private:
int myId;
};
if (aDataType == GL_NONE)
continue;
- OpenGl_VertexBuffer::bindAttribute(theGlCtx, anAttrib.Id, aNbComp,
+ OpenGl_VertexBuffer::bindAttribute(theGlCtx, anAttrib.Id, aNbComp,
aDataType, Stride, anOffset);
anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
}
public:
/// Constructor
/// \param theObj a presentation
- SketcherPrs_Element(const Handle(SketcherPrs_SymbolPrs)& theObj) :
+ SketcherPrs_Element(const Handle(SketcherPrs_SymbolPrs)& theObj) :
OpenGl_Element(), myObj(theObj) {}
/// Render the current presentation
/// Releases OpenGL resources
/// \param theContext OpenGL context
- virtual void Release (OpenGl_Context* theContext)
+ virtual void Release (OpenGl_Context* theContext)
{
if (!myObj.IsNull())
myObj->Release(theContext);
{
Handle(SketcherPrs_SymbolPrs) anIObj = (SketcherPrs_SymbolPrs*)theUserDraw->Data;
if (anIObj.IsNull()) {
- std::cout <<
+ std::cout <<
"VUserDrawCallback error: null object passed, the custom scene element will not be rendered"
<< std::endl;
}
std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsMap;
-SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false)
{
// Create an aspect with the icon
if (myAspect.IsNull()) {
Handle(Image_AlienPixMap) aIcon = icon();
- if (aIcon.IsNull())
+ if (aIcon.IsNull())
myAspect = new Graphic3d_AspectMarker3d();
else
myAspect = new Graphic3d_AspectMarker3d(aIcon);
}
}
-void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup,
+void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup,
std::string theAttrName) const
{
ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName);
}
void SketcherPrs_SymbolPrs::HilightOwnerWithColor(
- const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Quantity_NameOfColor theColor,
+ const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Quantity_NameOfColor theColor,
const Handle(SelectMgr_EntityOwner)& theOwner)
{
thePM->Color(this, theColor);
void SketcherPrs_SymbolPrs::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
// Create an icon
prepareAspect();
Handle(AIS_InteractiveContext) aCtx = GetContext();
- Handle(OpenGl_GraphicDriver) aDriver =
+ Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver());
if (!aDriver.IsNull()) {
// register the custom element factory function
// Update points with default shift value
// it updates array of points if the presentation is ready to display, or the array of points
// contains the previous values
-
+
bool aReadyToDisplay = updateIfReadyToDisplay(20);
int aNbVertex = myPntArray->VertexNumber();
if (theConflicting)
{
if (!myAspect.IsNull())
- myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255.,
+ myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255.,
theColor[2] / 255., Quantity_TOC_RGB));
myIsConflicting = true;
}
// this method is a combination of OCCT OpenGL functions. The main purpose is to have
// equal distance from the source object to symbol indpendently of zoom.
// It is base on OCCT 6.9.1 and might need changes when using later OCCT versions.
- // The specific SHAPER modifications are marked by ShaperModification:start/end,
+ // The specific SHAPER modifications are marked by ShaperModification:start/end,
// other is OCCT code
// do not update presentation for invalid or already removed objects: the presentation
const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker(Standard_True);
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
Handle(OpenGl_View) aView = theWorkspace->ActiveView();
-
+
// ShaperModification:start
double aScale = aView->Camera()->Scale();
// Update points coordinate taking the viewer scale into account
}
// Update drawing attributes
- if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements,
+ if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements,
aAttribs->Data(), GL_NONE, aAttribs->Stride)) {
myVboAttribs->Release (aCtx.operator->());
myVboAttribs.Nullify();
return;
}
-
+
Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes(aCtx);
-
+
if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) {
// ShaperModification:start : filling the presentation with color if there is a conflict
- const bool toHilight =
+ const bool toHilight =
(theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting;
// ShaperModification:end
- const Handle(OpenGl_PointSprite)& aSprite =
- (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())?
+ const Handle(OpenGl_PointSprite)& aSprite =
+ (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())?
anAspectMarker->SpriteHighlightRes(aCtx)
: aSpriteNorm;
theWorkspace->EnableTexture (aSprite);
- aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False,
+ aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False,
Standard_False, anAspectMarker->ShaderProgramRes(aCtx));
const TEL_COLOUR* aLineColor = &anAspectMarker->Color();
if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
}
}
-void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
+void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
const Handle(Prs3d_Presentation)& thePrs) const
{
if (theShape->isEdge()) {
// The shape is edge
- std::shared_ptr<GeomAPI_Curve> aCurve =
+ std::shared_ptr<GeomAPI_Curve> aCurve =
std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(theShape));
if (aCurve->isLine()) {
// The shape is line
- GeomAdaptor_Curve
+ GeomAdaptor_Curve
aCurv(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
StdPrs_Curve::Add(thePrs, aCurv, myDrawer);
} else {
// The shape is circle or arc
- GeomAdaptor_Curve
+ GeomAdaptor_Curve
aAdaptor(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
}
} else if (theShape->isVertex()) {
// draw vertex
- std::shared_ptr<GeomAPI_Vertex> aVertex =
+ std::shared_ptr<GeomAPI_Vertex> aVertex =
std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(theShape));
std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
}
void SketcherPrs_SymbolPrs::drawListOfShapes(
- const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
+ const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
const Handle(Prs3d_Presentation)& thePrs) const
{
int aNb = theListAttr->size();
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
-
+
virtual ~SketcherPrs_SymbolPrs();
//! Method which draws selected owners ( for fast presentation draw )
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners);
-
+
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw )
Standard_EXPORT virtual void HilightOwnerWithColor(
const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Quantity_NameOfColor theColor,
+ const Quantity_NameOfColor theColor,
const Handle(SelectMgr_EntityOwner)& theOwner);
/// Returns sketcher plane
/// when constraint become not conflicting
/// \param theConflicting a state
/// \param theColor a color for conflicting object
- Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting,
+ Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting,
const std::vector<int>& theColor);
/// Render of the presentation
/// Draw a shape into the given presentation scene
/// \param theShape the shape to draw
/// \param thePrs the presentation scene
- void drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
+ void drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
const Handle(Prs3d_Presentation)& thePrs) const;
/// Draw a list of shapes stored in a RefListAttribute
/// \param theListAttr the attribute of reference3s list
/// \param thePrs the presentation scene
- void drawListOfShapes(const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
+ void drawListOfShapes(const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
const Handle(Prs3d_Presentation)& thePrs) const;
protected:
/// An owner object of the presentation
Handle(SelectMgr_EntityOwner) myOwner;
-private:
+private:
/// Static map to collect constraints icons {IconName : IconPixMap}
static std::map<const char*, Handle(Image_AlienPixMap)> myIconsMap;
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
// Init default points
myPntArray = new Graphic3d_ArrayOfPoints(2);
myPntArray->AddVertex(0., 0., 0.);
myPntArray->AddVertex(0., 0., 0.);
-}
+}
bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
{
bool aReadyToDisplay = false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
- ObjectPtr aObj1 =
+ ObjectPtr aObj1 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
+ ObjectPtr aObj2 =
SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
// Compute points coordinates
return true;
}
-void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
aGroup->SetPrimitivesAspect(aLineAspect);
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Tangent)
}
//*************************************************************************************
-/// Find an attribute of the given object which corresponds to a vetrex
+/// Find an attribute of the given object which corresponds to a vetrex
/// defined by a shape
/// \param theObject an object
/// \param theShape a vertex
/// \param thePlane a projection plane (sketcher plane)
-std::shared_ptr<GeomDataAPI_Point2D> findGeomPoint(ObjectPtr theObject,
- const TopoDS_Shape& theShape,
+std::shared_ptr<GeomDataAPI_Point2D> findGeomPoint(ObjectPtr theObject,
+ const TopoDS_Shape& theShape,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
std::shared_ptr<GeomDataAPI_Point2D> aGeomPoint;
new GeomAPI_Pnt(aShapePoint.X(), aShapePoint.Y(), aShapePoint.Z()));
// find the given point in the feature attributes
- std::list<AttributePtr> anObjectAttiributes =
+ std::list<AttributePtr> anObjectAttiributes =
anObjectFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::const_iterator anIt = anObjectAttiributes.begin(),
+ std::list<AttributePtr>::const_iterator anIt = anObjectAttiributes.begin(),
aLast = anObjectAttiributes.end();
for (; anIt != aLast && !aGeomPoint; anIt++) {
- std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
+ std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
std::shared_ptr<GeomAPI_Pnt> anAttributePnt = thePlane->to3D(anAttributePoint->x(),
if (!theData.get() || !theData->isValid()) /// essential check as it is called in openGl thread)
return aLine;
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
if (anAttr) {
FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
} else if (aFeature->getKind() == SketchPlugin_Circle::ID()) { // circle
aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->pnt();
- } else
+ } else
return std::shared_ptr<GeomAPI_Pnt>();
std::shared_ptr<GeomAPI_Pnt2d> anOrigin(new GeomAPI_Pnt2d(0.0, 0.0));
return anAspect;
}
-void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect,
+void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect,
double theDimValue, double theTextSize)
{
double anArrowLength = theDimAspect->ArrowAspect()->Length();
void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError)
{
- Events_InfoMessage("SketcherPrs_Tools",
+ Events_InfoMessage("SketcherPrs_Tools",
"An empty AIS presentation: SketcherPrs_LengthDimension").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
std::shared_ptr<ModelAPI_Object> aConstraintPtr(theFeature);
/// Enumeration with modes for activation of selection custom presentations
enum SelectionModes {
/// Start of enumeration
- Sel_Mode_First = 100,
-
+ Sel_Mode_First = 100,
+
/// Selection mode for all constraints exclude dimensions
Sel_Constraint,
-
+
/// Selection mode for whole dimension
Sel_Dimension_All,
-
+
/// Selection mode for line of dimension
Sel_Dimension_Line,
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
- bool isTranslation)
+ bool isTranslation)
: SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
{
-}
+}
bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
// Get transformated objects list
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
if (anAttrB.get() == NULL)
return aReadyToDisplay;
AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData,
SketchPlugin_MultiTranslation::END_POINT_ID());
- aReadyToDisplay =
+ aReadyToDisplay =
aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized();
}
else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
// if it is rotation
- AttributePoint2DPtr aCenter =
+ AttributePoint2DPtr aCenter =
GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID());
aReadyToDisplay = aCenter.get() && aCenter->isInitialized();
}
return aReadyToDisplay;
}
-bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const
+bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const
{
if (!IsReadyToDisplay(myConstraint, myPlane))
return false;
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
- }
+ }
return true;
}
-void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& thePrs,
+void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
- std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
+ std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
if (anAttrB.get() == NULL)
return;
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
/// \param isTranslation a flag is it translation or rotation
- Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+ Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isTranslation);
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myOperationMgr->currentOperation());
if (aFOperation) {
- anActiveFeature = aFOperation->feature();
+ anActiveFeature = aFOperation->feature();
QStringList aNested = allNestedCommands(aFOperation);
foreach(QString aAction, myActions.keys()) {
if (!aNested.contains(aAction))
setActionEnabled(aAction, false);
}
- } else
+ } else
setNestedCommandsEnabled(false);
updateByPlugins(anActiveFeature);
}
break;
case Preview: {
- aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"),
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"),
aParent, 0, 0, "Compute preview");
aResult->setStatusTip(aResult->toolTip());
}
void XGUI_ActionsMgr::setNestedStackEnabled(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* anOperation =
+ ModuleBase_OperationFeature* anOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if(!anOperation || !anOperation->feature())
return;
QStringList XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation* theOperation)
{
QStringList aFeatures;
- ModuleBase_OperationFeature* anOperation =
+ ModuleBase_OperationFeature* anOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if(!anOperation || !anOperation->feature())
return aFeatures;
/// Return an action by the given id, if it was registered in the manager
QAction* action(const QString& theId);
- /// Return info (icon, text, etc) about the action by the given id,
+ /// Return info (icon, text, etc) about the action by the given id,
/// if it was registered in the manager
ActionInfo actionInfoById(const QString& theId);
//! Updates actions according to current selection in the viewer
void updateOnViewSelection();
-
+
//! Sets all actions to enabled state.
void setAllEnabled();
-
+
//! Sets all nested actions to isEnabled state for the command with given ID.
//! If ID is empty - all nested actions will be affected.
void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString());
-
+
//! Sets to enabled state all siblings of the given operation and it's parents recursively
void setNestedStackEnabled(ModuleBase_Operation* theOperation);
-
+
//! Sets the action with theId to theChecked state.
void setActionChecked(const QString& theId, const bool theChecked);
-
+
//! Sets the action with theId to theEnabled state.
void setActionEnabled(const QString& theId, const bool theEnabled);
-
+
//! Updates actions according to their "document" tag
void updateByDocumentKind();
bool containsValues(std::map<int, std::vector<int> >& theColorMap, std::vector<int>& theValues)
{
- std::map<int, std::vector<int> >::const_iterator anIt = theColorMap.begin(),
+ std::map<int, std::vector<int> >::const_iterator anIt = theColorMap.begin(),
aLast = theColorMap.end();
bool isFound = false;
for (; anIt != aLast && !isFound; anIt++) {
/// \param theValue an RGB components value
void setColor(const std::vector<int>& theValue);
- /// Returns a container with the current color value.
+ /// Returns a container with the current color value.
/// These are tree int values for RGB definition.
- /// These value is depend on the random choice and eighter
+ /// These value is depend on the random choice and eighter
/// a next random color or a certain color.
/// \return a vector of values
std::vector<int> getColor() const;
- /// Returns a container with the current color value.
+ /// Returns a container with the current color value.
/// These are tree int values for RGB definition.
/// It returns the next random color.
/// \return a vector of values
}
}
-void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
+void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
{
foreach(QAction* aAction, myActions)
aAction->setEnabled(false);
XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- QList<ModuleBase_ViewerPrsPtr> aPrsList =
+ QList<ModuleBase_ViewerPrsPtr> aPrsList =
aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
if (aPrsList.size() > 0) {
bool isVisible = false;
if (aRes && aRes->isDisplayed()) {
isVisible = true;
canBeShaded = myWorkshop->displayer()->canBeShaded(aObject);
- isShading =
+ isShading =
(myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading);
break;
}
} else {
foreach(int aMode, aModes) {
switch (aMode) {
- case TopAbs_VERTEX:
+ case TopAbs_VERTEX:
action("SELECT_VERTEX_CMD")->setChecked(true);
break;
- case TopAbs_EDGE:
+ case TopAbs_EDGE:
action("SELECT_EDGE_CMD")->setChecked(true);
break;
case TopAbs_FACE:
action("SELECT_RESULT_CMD")->setChecked(true);
}
}
- }
+ }
ModuleBase_IModule* aModule = myWorkshop->module();
if (aModule)
void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
{
XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
- QList<ModuleBase_ViewerPrsPtr> aPrsList =
+ QList<ModuleBase_ViewerPrsPtr> aPrsList =
aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
int aSelected = aPrsList.size();
QActionsList aActions;
{
QObjectPtrList anObjects = myWorkshop->selector()->selection()->selectedObjects();
if (!myWorkshop->abortAllOperations())
- return;
+ return;
// restore selection in case if dialog box was shown
myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
myWorkshop->objectBrowser()->onEditItem();
return;
if ((!aIsRoot) && (aIdx.internalPointer() != aActiveDoc.get()))
return;
-
+
// Get name of the selected index
aName = aIdx.data().toString();
aLen = aName.indexOf('(');
if (aLen != -1) {
aName = aName.left(--aLen);
}
- std::string aFeaturesStr = aIsRoot?
+ std::string aFeaturesStr = aIsRoot?
aDataModelXML->rootFolderFeatures(aName.toStdString()) :
aDataModelXML->subFolderFeatures(aName.toStdString());
if (aFeaturesStr.length() > 0) {
- QStringList aFeturesList =
+ QStringList aFeturesList =
QString(aFeaturesStr.c_str()).split(",", QString::SkipEmptyParts);
foreach(QString aFea, aFeturesList) {
QAction* aAction = aActionMgr->action(aFea);
{
theColor.clear();
// get color from the attribute of the result
- if (theResult.get() != NULL &&
+ if (theResult.get() != NULL &&
theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get() && aColorAttr->size()) {
// all AIS objects, where the color is not set, are in black.
// The color should be defined in XML or set in the attribute
theColor = Config_PropManager::color("Visualization", "object_default_color", "#000000");
- Events_InfoMessage("XGUI_CustomPrs",
+ Events_InfoMessage("XGUI_CustomPrs",
"A default color is not defined in the preferences for this kind of result").send();
}
}
SessionPtr aMgr = ModelAPI_Session::get();
if (aMgr->activeDocument() != theResult->document()) {
QColor aQColor(aColor[0], aColor[1], aColor[2]);
- QColor aNewColor =
+ QColor aNewColor =
QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF());
aColor[0] = aNewColor.red();
aColor[1] = aNewColor.green();
if (aFolderId != -1) {
insertRow(aRow, createIndex(aFolderId, 0, -1));
}
- }
+ }
}
} else {
// Object created in sub-document
// Update a group under root
if (aGroup == myXMLReader->rootType()) // Update objects under root
aStartId = foldersCount();
- else // Update objects in folder under root
+ else // Update objects in folder under root
aParent = createIndex(folderId(aGroup), 0, -1);
} else {
// Update a sub-document
// Update sub-document root
aParent = findDocumentRootIndex(aDoc.get());
aStartId = foldersCount(aDoc.get());
- } else
+ } else
// update folder in sub-document
aParent = createIndex(folderId(aGroup, aDoc.get()), 0, aDoc.get());
}
QModelIndex aDocRoot = findDocumentRootIndex(aDoc.get());
if (aDocRoot.isValid())
emit dataChanged(aDocRoot, aDocRoot);
- else
+ else
// We have got a new document
rebuildDataTree();
}
- }
+ }
}
//******************************************************
}
if (aRow == -1)
return QModelIndex();
- else
+ else
return createIndex(aRow, 0, theObject.get());
}
SessionPtr aSession = ModelAPI_Session::get();
DocumentPtr aRootDoc = aSession->moduleDocument();
- if (aDoc == aRootDoc && myXMLReader->rootType() == aType) {
+ if (aDoc == aRootDoc && myXMLReader->rootType() == aType) {
// The object from root document
aRow += foldersCount();
- } else if (myXMLReader->subType() == aType) {
+ } else if (myXMLReader->subType() == aType) {
// The object from sub document
aRow += foldersCount(aDoc.get());
}
if (aParentId == -1) { // root folders
switch (theRole) {
case Qt::DisplayRole:
- return QString(myXMLReader->rootFolderName(theIndexRow).c_str()) +
+ return QString(myXMLReader->rootFolderName(theIndexRow).c_str()) +
QString(" (%1)").arg(rowCount(theIndex));
case Qt::DecorationRole:
return QIcon(myXMLReader->rootFolderIcon(theIndexRow).c_str());
if (aSubDoc) { // this is a folder of sub document
QIntList aMissedIdx = missedFolderIndexes(aSubDoc);
int aRow = theIndexRow;
- while (aMissedIdx.contains(aRow))
+ while (aMissedIdx.contains(aRow))
aRow++;
switch (theRole) {
case Qt::DisplayRole:
- return QString(myXMLReader->subFolderName(aRow).c_str()) +
+ return QString(myXMLReader->subFolderName(aRow).c_str()) +
QString(" (%1)").arg(rowCount(theIndex));
case Qt::DecorationRole:
return QIcon(myXMLReader->subFolderIcon(aRow).c_str());
{
if (aObj->groupName() == ModelAPI_ResultParameter::group()) {
ModelAPI_ResultParameter* aParam = dynamic_cast<ModelAPI_ResultParameter*>(aObj);
- AttributeDoublePtr aValueAttribute =
+ AttributeDoublePtr aValueAttribute =
aParam->data()->real(ModelAPI_ResultParameter::VALUE());
QString aVal = QString::number(aValueAttribute->value());
QString aTitle = QString(aObj->data()->name().c_str());
}
int aId = theParent.internalId();
- if (aId == -1) {
+ if (aId == -1) {
// this is a folder under root
int aParentPos = theParent.row();
std::string aType = myXMLReader->rootFolderType(aParentPos);
} else {
// It is an object which could have children
ModelAPI_Document* aDoc = getSubDocument(theParent.internalPointer());
- if (aDoc) {
+ if (aDoc) {
// a folder of sub-document
QIntList aMissedIdx = missedFolderIndexes(aDoc);
int aRow = theParent.row();
- while (aMissedIdx.contains(aRow))
+ while (aMissedIdx.contains(aRow))
aRow++;
std::string aType = myXMLReader->subFolderType(aRow);
return aDoc->size(aType);
} else {
// Check for composite object
ModelAPI_CompositeFeature* aCompFeature = dynamic_cast<ModelAPI_CompositeFeature*>(aObj);
- if (aCompFeature)
+ if (aCompFeature)
return aCompFeature->numberOfSubs(true);
ModelAPI_ResultCompSolid* aCompRes = dynamic_cast<ModelAPI_ResultCompSolid*>(aObj);
- if (aCompRes)
+ if (aCompRes)
return aCompRes->numberOfSubs(true);
}
}
} else {
// It is an object which could have children
ModelAPI_Document* aDoc = getSubDocument(theParent.internalPointer());
- if (aDoc) {
+ if (aDoc) {
// It is a folder of sub-document
int aParentRow = aParentPos;
QIntList aMissedIdx = missedFolderIndexes(aDoc);
}
} else {
// Check for composite object
- ModelAPI_CompositeFeature* aCompFeature =
+ ModelAPI_CompositeFeature* aCompFeature =
dynamic_cast<ModelAPI_CompositeFeature*>(aParentObj);
if (aCompFeature) {
aIndex = objectIndex(aCompFeature->subFeature(theRow));
} else {
- ModelAPI_ResultCompSolid* aCompRes =
+ ModelAPI_ResultCompSolid* aCompRes =
dynamic_cast<ModelAPI_ResultCompSolid*>(aParentObj);
- if (aCompRes)
+ if (aCompRes)
aIndex = objectIndex(aCompRes->subResult(theRow));
}
}
int aId = theIndex.internalId();
if (aId != -1) { // The object is not a root folder
ModelAPI_Document* aDoc = getSubDocument(theIndex.internalPointer());
- if (aDoc) {
+ if (aDoc) {
// It is a folder of sub-document
return findDocumentRootIndex(aDoc);
}
return createIndex(aFolderId, 0, aSubDoc.get());
}
}
- }
+ }
return QModelIndex();
}
if (aObj) {
// An object
- if (aObj->isDisabled())
+ if (aObj->isDisabled())
return theIndex.column() == 1? Qt::ItemIsSelectable : aNullFlag;
if (aSession->moduleDocument() != aObj->document())
if (aActiveDoc != aObj->document())
return theIndex.column() == 1? Qt::ItemIsSelectable : aNullFlag;
-
+
bool isCompositeSub = false;
// An object which is sub-object of a composite object can not be accessible in column 1
if (theIndex.column() == 1) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjPtr);
if (aFeature.get()) {
CompositeFeaturePtr aCompFea = ModelAPI_Tools::compositeOwner(aFeature);
- if (aCompFea.get())
+ if (aCompFea.get())
isCompositeSub = true;
} else {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObjPtr);
if (aResult.get()) {
ResultCompSolidPtr aCompRes = ModelAPI_Tools::compSolidOwner(aResult);
- if (aCompRes.get())
+ if (aCompRes.get())
isCompositeSub = true;
}
}
DocumentPtr aRootDoc = aSession->moduleDocument();
if (theDoc == aRootDoc)
return QModelIndex();
- else
+ else
return findDocumentRootIndex(theDoc.get());
}
} else {
if (aCurDoc == aSession->moduleDocument())
return createIndex(foldersCount() - 1, 1, -1);
- else
+ else
return createIndex(foldersCount(aCurDoc.get()) - 1, 1, aCurDoc.get());
}
}
virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
Qt::DisplayRole) const;
- /// Returns the number of rows under the given parent. When the parent is valid it means that
+ /// Returns the number of rows under the given parent. When the parent is valid it means that
/// rowCount is returning the number of children of parent.
/// \param theParent a parent model index
virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
/// \param theParent a parent model index
virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
- /// Returns the index of the item in the model specified by the given row,
+ /// Returns the index of the item in the model specified by the given row,
/// column and parent index.
/// \param theRow a row
/// \param theColumn a column
virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent =
QModelIndex()) const;
- /// Returns the parent of the model item with the given index.
+ /// Returns the parent of the model item with the given index.
/// If the item has no parent, an invalid QModelIndex is returned.
/// \param theIndex a model index
virtual QModelIndex parent(const QModelIndex& theIndex) const;
/// \param theParent a parent model index
virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
- /// Inserts count rows into the model before the given row.
+ /// Inserts count rows into the model before the given row.
/// Items in the new row will be children of the item represented by the parent model index.
/// \param theRow a start row
/// \param theCount a nember of rows to insert
/// \param theDoc the document object
QModelIndex findDocumentRootIndex(const ModelAPI_Document* theDoc) const;
- /// Returns number of folders in document.
+ /// Returns number of folders in document.
/// Considered folders which has to be shown only if they are not empty.
/// \param theDoc document which has to be checked. If 0 then Root document will be considered
int foldersCount(ModelAPI_Document* theDoc = 0) const;
/// Retrurns indexes of folders which can not be shown because they are empty
- /// \param theDoc document which has to be checked. If 0 then Root document will be considered
+ /// \param theDoc document which has to be checked. If 0 then Root document will be considered
QIntList missedFolderIndexes(ModelAPI_Document* theDoc = 0) const;
- /// Returns Id (row) of a folder taking into consideration
+ /// Returns Id (row) of a folder taking into consideration
/// folders which can not be shown non empty
/// \param theType Type of the folder
/// \param theDoc a document which contains this folder
#include <set>
/// defines the local context mouse selection sensitivity
-const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
+const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
//#define DEBUG_ACTIVATE_OBJECTS
//#define DEBUG_DEACTIVATE
bool aDisplayed = false;
if (isVisible(theObject)) {
#ifdef DEBUG_COMPOSILID_DISPLAY
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
if (aPrs.get() != NULL) {
anAIS = aPrs->getAISObject(anAIS);
if (anAIS.get()) {
- // correct deviation coefficient for
+ // correct deviation coefficient for
/*Handle(AIS_InteractiveObject) anAISPrs = anAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAISPrs.IsNull()) {
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get() != NULL) {
#ifdef DEBUG_COMPOSILID_DISPLAY
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
if (aShapePtr.get() != NULL) {
anAIS = AISObjectPtr(new GeomAPI_AISObject());
- Handle(AIS_InteractiveObject) anAISPrs =
+ Handle(AIS_InteractiveObject) anAISPrs =
myWorkshop->module()->createPresentation(aResult);
if (anAISPrs.IsNull())
anAISPrs = new ModuleBase_ResultPrs(aResult);
return false;
}
-bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
+bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
bool isShading, bool theUpdateViewer)
{
bool aDisplayed = false;
if (isShading)
anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
anAISIO->SetDisplayMode(aDispMode);
- aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+ aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
aDisplayed = true;
emit objectDisplayed(theObject, theAIS);
activate(anAISIO, myActiveSelectionModes, theUpdateViewer);
- }
+ }
if (theUpdateViewer)
updateViewer();
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!aContext.IsNull() && !aAISIO.IsNull()) {
// Check that the visualized shape is the same and the redisplay is not necessary
- // Redisplay of AIS object leads to this object selection compute and the selection
+ // Redisplay of AIS object leads to this object selection compute and the selection
// in the browser is lost
// this check is not necessary anymore because the selection store/restore is realized
// before and after the values modification.
deactivateAIS(anAIS);
// the selection from the previous activation modes should be cleared manually (#26172)
aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
- ModuleBase_Tools::selectionInfo(aContext,
+ ModuleBase_Tools::selectionInfo(aContext,
"XGUI_Displayer::deactivate -- ClearOutdatedSelection");
if (theUpdateViewer)
updateViewer();
int XGUI_Displayer::getSelectionMode(int theShapeType)
{
- return (theShapeType > TopAbs_SHAPE) ? theShapeType :
+ return (theShapeType > TopAbs_SHAPE) ? theShapeType :
AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType);
}
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aPrs.get() || aResult.get()) {
aVisible = theDisplayer->isVisible(theObject);
- // compsolid is not visualized in the viewer,
+ // compsolid is not visualized in the viewer,
// but should have presentation when all sub solids are
// visible. It is useful for highlight presentation where compsolid shape is selectable
if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultCompSolid::group()) {
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
bool anAllSubsVisible = aCompsolidResult->numberOfSubs() > 0;
myActiveSelectionModes = aNewModes;
Handle(AIS_InteractiveContext) aContext = AISContext();
// Open local context if there is no one
- if (aContext.IsNull() || !aContext->HasOpenedContext())
+ if (aContext.IsNull() || !aContext->HasOpenedContext())
return;
//aContext->UseDisplayedObjects();
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext.IsNull() || !isVisible(theObject))
return false;
-
+
AISObjectPtr anObj = myResult2AISObjectMap[theObject];
Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
}
-void XGUI_Displayer::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues,
+void XGUI_Displayer::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues,
bool theUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext->HasOpenedContext()) {
aContext->UnhilightSelected(false);
aContext->ClearSelected(false);
- NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
+ NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
aShapesToBeSelected;
foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
}
}
}
- ModuleBase_Tools::selectionInfo(aContext,
+ ModuleBase_Tools::selectionInfo(aContext,
"XGUI_Displayer::setSelected -- AddOrRemoveSelected/UnhilightCurrents(no local context)");
if (theUpdateViewer)
updateViewer();
// the fix from VPA for more suitable selection of sketcher lines
if (theIO->Width() > 1) {
double aPrecision = theIO->Width() + 2;
- if (theMode == getSelectionMode(TopAbs_VERTEX))
- aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
+ if (theMode == getSelectionMode(TopAbs_VERTEX))
+ aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
"point-selection-sensitivity",
20);
- else if ((theMode == getSelectionMode(TopAbs_EDGE)) ||
+ else if ((theMode == getSelectionMode(TopAbs_EDGE)) ||
(theMode == getSelectionMode(TopAbs_WIRE)))
- aPrecision = theIO->Width() +
- ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
+ aPrecision = theIO->Width() +
+ ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
"edge-selection-sensitivity", 2);
aContext->SetSelectionSensitivity(theIO, theMode, aPrecision);
}
}
}
-void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
+void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
const int theMode) const
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!aContext.IsNull()) {
if (theMode == -1)
aContext->Deactivate(theIO);
- else
+ else
aContext->Deactivate(theIO, theMode);
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivateAIS -- Deactivate");
-
+
#ifdef DEBUG_DEACTIVATE_AIS
ObjectPtr anObject = getObject(theIO);
anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
}
bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
-{
+{
if (!isVisible(theObject))
return false;
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext.IsNull() || theIO.IsNull())
return false;
-
+
bool isActivationChanged = false;
// deactivate object in all modes, which are not in the list of activation
// It seems that after the IO deactivation the selected state of the IO's owners
// If the selection problem happens again, it is possible to write a test scenario and create
// a bug. The bug steps are the following:
// Create two IO, activate them in 5 modes, select the first IO, deactivate 3 modes for both,
- // with clicked SHIFT select the second object.
+ // with clicked SHIFT select the second object.
// The result is the selection of the first IO is lost.
TColStd_ListOfInteger aTColModes;
aContext->ActivatedModes(theIO, aTColModes);
// the selection from the previous activation modes should be cleared manually (#26172)
theIO->ClearSelected();
aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
- ModuleBase_Tools::selectionInfo(aContext,
+ ModuleBase_Tools::selectionInfo(aContext,
"XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
// For performance issues
//if (theUpdateViewer)
}
-QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject,
- const QColor& theColor,
+QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject,
+ const QColor& theColor,
bool theUpdateViewer)
{
if (!isVisible(theObject))
aPtrStr << "aObj = " << aObj.get() << ":";
aPtrStr << "anAIS = " << aAISObj.get() << ":";
aPtrStr << "[" << ModuleBase_Tools::objectInfo(aObj).toStdString().c_str() << "]";
-
+
aContent.append(aPtrStr.str().c_str());
}
return QString("myResult2AISObjectMap: size = %1\n%2\n").arg(myResult2AISObjectMap.size()).
}
}
-void XGUI_Displayer::activateTrihedron(bool theIsActive)
-{
- myIsTrihedronActive = theIsActive;
+void XGUI_Displayer::activateTrihedron(bool theIsActive)
+{
+ myIsTrihedronActive = theIsActive;
if (!myIsTrihedronActive) {
deactivateTrihedron(true);
}
updateViewer();
}
-QIntList XGUI_Displayer::activeSelectionModes() const
-{
+QIntList XGUI_Displayer::activeSelectionModes() const
+{
QIntList aModes;
foreach (int aMode, myActiveSelectionModes) {
// aMode < 9 is a Shape Enum values
aModes << ((aMode < 9)? AIS_Shape::SelectionType(aMode) : aMode);
}
- return aModes;
+ return aModes;
}
void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
Q_OBJECT
public:
/// \enum DisplayMode display mode
- enum DisplayMode {
+ enum DisplayMode {
/// Mode is not defined
- NoMode = -1,
+ NoMode = -1,
/// Wireframe display mode
- Wireframe,
+ Wireframe,
/// Shading display mode
- Shading
+ Shading
};
/// Constructor
/// \return true if the object visibility state is changed
bool display(ObjectPtr theObject, bool theUpdateViewer = true);
- /// Display the given AIS object.
+ /// Display the given AIS object.
/// This object is not added to the displayer internal map of objects
/// So, it can not be obtained from displayer. This is just a wrap method of OCC display in
/// order to perform the display with correct flags.
/// empty, select it, otherwise select the result.
/// \param theValues a list of presentation to be selected
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
- void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
bool theUpdateViewer = true);
/// Unselect all objects
/// Remove all selection filters
void removeFilters();
- /// Sets a flag to the displayer whether the internal viewer can be updated by
+ /// Sets a flag to the displayer whether the internal viewer can be updated by
/// the updateViewer method call. If it is not enabled, this method do nothing.
/// This state maintain recurse, if the update is blocked twice or three times, the
/// viewer will not be updated until it is unblocked necessary times
void activateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode,
const bool theUpdateViewer) const;
- /// Activate interactive context. It is necessary to call ClearOutdatedSelection
+ /// Activate interactive context. It is necessary to call ClearOutdatedSelection
/// after deactivation
/// \param theIO an interactive object
/// \param theMode a mode to deactivate. When theMode=-1 then all modes will be deactivated
bool canBeShaded(ObjectPtr theObject) const;
/// Set color on presentation of an object if it is displayed
- /// \param theObject an object
+ /// \param theObject an object
/// \param theColor a color which has to be set
/// \param theUpdateViewer update viewer flag
/// \return previously defined color on the object
/// Returns Trihedron object if it is displayed
Handle(AIS_InteractiveObject) getTrihedron() const;
-
+
/// Set trihedron active (used in selection) or non active
void activateTrihedron(bool theIsActive);
/// of owners in the context only once.
/// \param theContext a viewer context. It has opened local context
/// \param theShapesToBeSelected a map of shapes. Owner's shape is searched in the map and the
- /// owner is selected if it is found there.
+ /// owner is selected if it is found there.
/// Only first owner is processed(according to OCCT logic)
static void AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
const NCollection_DataMap<TopoDS_Shape,
QString anError = "";
/// to allow the module have the button always enabled
- bool isActionStateEnabled =
+ bool isActionStateEnabled =
myWorkshop->module()->isActionEnableStateFixed(XGUI_ActionsMgr::AcceptAll);
if (!isActionStateEnabled) {
anError = myWorkshop->module()->getFeatureError(theFeature);
void XGUI_MenuMgr::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
//A message to start feature creation received.
- if (theMessage->eventID() ==
+ if (theMessage->eventID() ==
Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
aResultWorkbench = aWorkbench;
}
if (!aResultWorkbench) {
- aResultWorkbench =
+ aResultWorkbench =
std::shared_ptr<XGUI_MenuWorkbench>(new XGUI_MenuWorkbench(theWorkbenchName));
myWorkbenches.push_back(aResultWorkbench);
}
for (; aGIt != aGLast; aGIt++) {
const std::shared_ptr<XGUI_MenuGroup> aGroup = *aGIt;
std::string aGName = aGroup->getName();
- const std::list<std::shared_ptr<Config_FeatureMessage> >& aFeaturesInfo =
+ const std::list<std::shared_ptr<Config_FeatureMessage> >& aFeaturesInfo =
aGroup->featuresInfo();
- std::list<std::shared_ptr<Config_FeatureMessage> >::const_iterator aFIt =
+ std::list<std::shared_ptr<Config_FeatureMessage> >::const_iterator aFIt =
aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end();
int aFSize = aFeaturesInfo.size();
for(int i = 0; aFIt != aFLast; aFIt++, i++) {
XGUI_Workshop* myWorkshop; ///< the current workshop
/// container of existing workbenchs
- std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches;
+ std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches;
};
#endif /* XGUI_MENUMGR_H_ */
myWorkshop->selector()->clearSelection();
} else {
aDisp->setSelected(theValues);
- }
+ }
}
void XGUI_ModuleConnector::setStatusBarMessage(const QString& theMessage)
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
if (anOperationMgr->startOperation(theOperation)) {
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation) {
workshop()->propertyPanel()->updateContentWidget(aFOperation->feature());
myWorkshop->updateCommandStatus();
}
-QMainWindow* XGUI_ModuleConnector::desktop() const
-{
- return myWorkshop->desktop();
+QMainWindow* XGUI_ModuleConnector::desktop() const
+{
+ return myWorkshop->desktop();
}
{
#ifdef HAVE_SALOME
return myWorkshop->salomeConnector()->featureInfo(theId);
-#else
- AppElements_Command* aAction =
+#else
+ AppElements_Command* aAction =
dynamic_cast<AppElements_Command*>(myWorkshop->actionsMgr()->action(theId));
if (aAction)
return aAction->featureMessage();
//! Returns data object by AIS
virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
- //! Select features clearing previous selection.
+ //! Select features clearing previous selection.
//! If the list is empty then selection will be cleared
virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
setItemDelegateForColumn(0, new XGUI_TreeViewItemDelegate(this));
- connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
+ connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
SLOT(onDoubleClick(const QModelIndex&)));
}
aEntrance = 0;
}
-void XGUI_DataTree::clear()
+void XGUI_DataTree::clear()
{
dataModel()->clear();
reset();
ObjectPtr aObj = aModel->object(theIndex);
DocumentPtr aDoc = aMgr->activeDocument();
-
+
std::string aOpName = tr("History change").toStdString();
if (aObj.get()) {
if (aObj->document() != aDoc)
//********************************************************************
//********************************************************************
//********************************************************************
-void XGUI_TreeViewStyle::drawPrimitive(PrimitiveElement theElement,
+void XGUI_TreeViewStyle::drawPrimitive(PrimitiveElement theElement,
const QStyleOption* theOption,
QPainter* thePainter, const QWidget* theWidget) const
{
if ((theElement == QStyle::PE_PanelItemViewRow) || (theElement == QStyle::PE_PanelItemViewItem)) {
- const QStyleOptionViewItemV4* aOptions =
+ const QStyleOptionViewItemV4* aOptions =
qstyleoption_cast<const QStyleOptionViewItemV4 *>(theOption);
if (myIndex.isValid() && ((myIndex.flags() & Qt::ItemIsSelectable) == 0)) {
QStyle::State aState = aOptions->state;
//********************************************************************
//********************************************************************
XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent )
- : QLabel(theText, theParent),
- myPreSelectionStyle(""),
- myNeutralStyle(""),
+ : QLabel(theText, theParent),
+ myPreSelectionStyle(""),
+ myNeutralStyle(""),
mySelectionStyle(""),
myIsSelected(false)
{
QColor aHighlightText = aPalet.highlightedText().color();
myPreSelectionStyle = "QLabel {background-color: ";
- myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " +
+ myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " +
aHighlight.lighter(170).name() + ");";
myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }";
#if (!defined HAVE_SALOME) && (defined WIN32)
mySelectionStyle = "QLabel {background-color: ";
mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(236, 245, 255)";
- mySelectionStyle += ", stop:1 rgb(208, 229, 255));";
+ mySelectionStyle += ", stop:1 rgb(208, 229, 255));";
mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: 2px }";
#else
mySelectionStyle = "QLabel {background-color: " + aHighlight.name();
MYClearing = true;
myIsSelected = true;
setStyleSheet(mySelectionStyle);
- // We can not block signals because on
+ // We can not block signals because on
// clear selection the View state will not be updated
myTreeView->clearSelection();
QLabel::mouseReleaseEvent(e);
aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
aLbl->setMargin(2);
// Do not paint background of the label (in order to show icon)
- aLbl->setAutoFillBackground(false);
+ aLbl->setAutoFillBackground(false);
aLabelLay->addWidget(aLbl);
}
void XGUI_ObjectsBrowser::setXMLReader(Config_DataModelReader* theReader)
-{
- myDocModel->setXMLReader(theReader);
+{
+ myDocModel->setXMLReader(theReader);
myTreeView->setModel(myDocModel);
// It has to be done after setting of model
}
//***************************************************
-void XGUI_ObjectsBrowser::clearContent()
-{
- myTreeView->clear();
+void XGUI_ObjectsBrowser::clearContent()
+{
+ myTreeView->clear();
}
void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
{
QStringList result;
foreach(ModuleBase_Operation* eachOperation, myOperations) {
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(eachOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
(anOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
- CompositeFeaturePtr aComposite =
+ CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
isCompositeCommitted = aComposite.get();
if (isCompositeCommitted)
{
XGUI_ErrorMgr* anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr();
if (theOperation) {
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation)
anErrorMgr->updateAcceptAllAction(aFOperation->feature());
}
else if (canStopOperation(aCurrentOp)) {
// the started operation is granted in the parrent operation,
- // e.g. current - Line in Sketch, started Circle
+ // e.g. current - Line in Sketch, started Circle
stopOperation(aCurrentOp);
} else {
aCanStart = false;
return;
/// Set current feature and remeber old current feature
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
if (aFOperation) {
SessionPtr aMgr = ModelAPI_Session::get();
// When sketch entity operation started, the sketch should be cashed here as the current.
// Otherwise(the flag is true), the ExtrusionCut is cashed, when commit happens, the sketch
// is disabled, sketch entity is disabled as extrusion cut is created earliest then sketch.
- // As a result the sketch disappears from the viewer.
+ // As a result the sketch disappears from the viewer.
// However after commit it is displayed back.
aFOperation->setPreviousCurrentFeature(aDoc->currentFeature(false));
if (aFOperation->isEditOperation()) {// it should be performed by the feature edit only
// in create operation, the current feature is changed by addFeature()
aDoc->setCurrentFeature(aFOperation->feature(), false);
- // this is the only place where flushes must be called after setCurrentFeature for the
- // current moment: after this the opertion is not finished, so, the ObjectBrowser
+ // this is the only place where flushes must be called after setCurrentFeature for the
+ // current moment: after this the opertion is not finished, so, the ObjectBrowser
// state may be corrupted (issue #1457)
static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED);
return;
/// Restore the previous current feature
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
if (aFOperation) {
#ifdef DEBUG_CURRENT_FEATURE
setCurrentFeature(aFOperation->previousCurrentFeature());
}
else { // create operation
- // the Top created feature should stays the current. In nested operations,
+ // the Top created feature should stays the current. In nested operations,
// like Line in the Sketch or
- // Sketch in ExtrusionCut, a previous feature should be restored on commit.
+ // Sketch in ExtrusionCut, a previous feature should be restored on commit.
// It is performed here
// in order to perform it in the current transaction without opening a new one.
if (myOperations.front() != aFOperation)
bool isAborted = false;
if (!anActiveWgt) {
QWidget* aFocusWidget = aPanel->focusWidget();
- QToolButton* aCancelBtn =
+ QToolButton* aCancelBtn =
dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_CANCEL);
if (aFocusWidget && aCancelBtn && aFocusWidget == aCancelBtn) {
abortOperation(aOperation);
if (!isAborted) {
isAccepted = anActiveWgt && anActiveWgt->processEnter();
if (!isAccepted) {
- isAccepted =
+ isAccepted =
myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : "");
if (!isAccepted) {
/// functionality is similar to Apply click
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
- if (!aFOperation ||
+ if (!aFOperation ||
myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
- // key released is emitted to apply the current value to the model
+ // key released is emitted to apply the current value to the model
// if it was modified in PP
emit keyEnterReleased();
commitOperation();
//#define DEBUG_TAB_WIDGETS
XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr)
- : ModuleBase_IPropertyPanel(theParent),
+ : ModuleBase_IPropertyPanel(theParent),
myActiveWidget(NULL),
myPreselectionWidget(NULL),
myPanelPage(NULL),
// sketch multi rotation -> single/full point)
// it is important to check the widget visibility to do not check of the next widget visible
// state if the current is not shown. (example: sketch circle re-entrant operation after mouse
- // release in the viewer, next, radius,
+ // release in the viewer, next, radius,
// widget should be activated but the first is not visualized)
bool isVisible = theWidget->isVisible();
activateNextWidget(theWidget, isVisible);
theEvent->ignore();
else
theEvent->accept();
- } else
+ } else
theEvent->ignore();
} else
ModuleBase_IPropertyPanel::closeEvent(theEvent);
#include "XGUI_QtEvents.h"
-QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType =
+QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType =
QEvent::Type(QEvent::registerEventType());
//! \param isAddSeparator boolean flag about adding separator after the action
//! returns created action
virtual QAction* addFeature(const QString& theWBName, const QString& theId,
- const QString& theTitle, const QString& theTip,
+ const QString& theTitle, const QString& theTip,
const QIcon& theIcon,
- const QKeySequence& theKeys, bool isCheckable,
+ const QKeySequence& theKeys, bool isCheckable,
const bool isAddSeparator,
const QString& theStatusTip) = 0;
{
thePrs->setOwner(theOwner);
- Handle(AIS_InteractiveObject) anIO =
+ Handle(AIS_InteractiveObject) anIO =
Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
thePrs->setInteractive(anIO);
aShape = findAxisShape(anIO);
#endif
if (!aShape.IsNull()) {
- std::shared_ptr<GeomAPI_Shape> aGeomShape =
+ std::shared_ptr<GeomAPI_Shape> aGeomShape =
std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aGeomShape->setImpl(new TopoDS_Shape(aShape));
thePrs->setShape(aGeomShape);
gp_Lin aLine = aAxis->Component()->Lin();
gp_Dir aDir = aLine.Direction();
std::string aAxName;
- if (aDir.X() == 1.)
+ if (aDir.X() == 1.)
aAxName = "OX";
else if (aDir.Y() == 1.)
aAxName = "OY";
}
#endif
}
-
+
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
ObjectPtr aFeature = aDisplayer->getObject(anIO);
if (aContext->HasOpenedContext()) {
TopoDS_Shape aShape = aContext->DetectedShape();
if (!aShape.IsNull()) {
- std::shared_ptr<GeomAPI_Shape> aGeomShape =
+ std::shared_ptr<GeomAPI_Shape> aGeomShape =
std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aGeomShape->setImpl(new TopoDS_Shape(aShape));
aPrs->setShape(aGeomShape);
Handle(SelectMgr_EntityOwner) aEO = theOwner;
if (!aEO.IsNull()) {
- Handle(AIS_InteractiveObject) anObj =
+ Handle(AIS_InteractiveObject) anObj =
Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable());
anObject = myWorkshop->displayer()->getObject(anObj);
}
Handle(Prs3d_DatumAspect) DA = aAxis->Attributes()->DatumAspect();
Handle(Geom_TrimmedCurve) aTLine = new Geom_TrimmedCurve(aLine, 0, DA->FirstAxisLength());
- BRep_Builder aBuilder;
+ BRep_Builder aBuilder;
TopoDS_Edge aEdge;
aBuilder.MakeEdge(aEdge, aTLine, Precision::Confusion());
if (!aEdge.IsNull())
/// Returns a list of viewer selected presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
getSelected(const SelectionPlace& thePlace = Browser) const;
/// Fills the viewer presentation parameters by the parameters from the owner
aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
}
}
- ModuleBase_Tools::selectionInfo(aContext,
+ ModuleBase_Tools::selectionInfo(aContext,
"XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected");
}
FeaturePtr aFeature;
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (!aContext.IsNull()) {
- QList<ModuleBase_ViewerPrsPtr> aPresentations =
+ QList<ModuleBase_ViewerPrsPtr> aPresentations =
selection()->getSelected(ModuleBase_ISelection::Viewer);
foreach(ModuleBase_ViewerPrsPtr aPrs, aPresentations) {
if (aPrs->object().get()) {
bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
myWorkshop->objectBrowser()->blockSignals(aBlocked);
-
+
QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
QString file(const QString& path, bool withExt)
{
QString fPath = path;
- while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' ||
+ while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' ||
fPath[fPath.length() - 1] == '/'))
fPath.remove(fPath.length() - 1, 1);
if (std::dynamic_pointer_cast<ModelAPI_ResultParameter>(theObject).get()) {
double aValue;
ResultParameterPtr aParam;
- if (ModelAPI_Tools::findVariable(theObject->document(),
+ if (ModelAPI_Tools::findVariable(theObject->document(),
FeaturePtr(), qPrintable(theName), aValue, aParam)) {
const char* aKeyStr = "Selected parameter can not be renamed to: %1. "
"There is a parameter with the same name. Its value is: %2.";
QString aErrMsg(QObject::tr(aKeyStr).arg(qPrintable(theName)).arg(aValue));
- // We can not use here a dialog box for message -
+ // We can not use here a dialog box for message -
// it will crash editing process in ObjectBrowser
Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
return false;
#include <AppElements_ViewWindow.h>
#include <AppElements_Viewer.h>
#endif
-
+
#include <ModuleBase_IViewWindow.h>
#include <QEvent>
return myWorkshop->salomeConnector()->viewer()->activeView();
#else
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
- return (aViewer->activeViewWindow()) ?
+ return (aViewer->activeViewWindow()) ?
aViewer->activeViewWindow()->viewPortApp()->getView() :
Handle(V3d_View)();
#endif
return myWorkshop->salomeConnector()->viewer()->activeViewPort();
#else
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
- return (aViewer->activeViewWindow()) ?
+ return (aViewer->activeViewWindow()) ?
aViewer->activeViewWindow()->viewPortApp(): 0;
#endif
}
ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer();
connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed()));
- connect(aViewer, SIGNAL(tryCloseView(ModuleBase_IViewWindow*)),
+ connect(aViewer, SIGNAL(tryCloseView(ModuleBase_IViewWindow*)),
this, SIGNAL(tryCloseView(ModuleBase_IViewWindow*)));
- connect(aViewer, SIGNAL(deleteView(ModuleBase_IViewWindow*)),
+ connect(aViewer, SIGNAL(deleteView(ModuleBase_IViewWindow*)),
this, SIGNAL(deleteView(ModuleBase_IViewWindow*)));
- connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
+ connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
this, SLOT(onViewCreated(ModuleBase_IViewWindow*)));
- connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow*)),
+ connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow*)),
this, SIGNAL(activated(ModuleBase_IViewWindow*)));
- connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)),
+ connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)));
- connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
+ connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
connect(aViewer, SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)), this,
SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)));
- connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
+ connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
- connect(aViewer, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*)),
+ connect(aViewer, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*)),
this, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*)));
- connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
+ connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
this, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
-
+
connect(aViewer, SIGNAL(viewTransformed(int)), this, SIGNAL(viewTransformed(int)));
connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed()));
- connect(aViewer, SIGNAL(tryCloseView(AppElements_ViewWindow*)),
+ connect(aViewer, SIGNAL(tryCloseView(AppElements_ViewWindow*)),
this, SLOT(onTryCloseView(AppElements_ViewWindow*)));
- connect(aViewer, SIGNAL(deleteView(AppElements_ViewWindow*)),
+ connect(aViewer, SIGNAL(deleteView(AppElements_ViewWindow*)),
this, SLOT(onDeleteView(AppElements_ViewWindow*)));
- connect(aViewer, SIGNAL(viewCreated(AppElements_ViewWindow*)),
+ connect(aViewer, SIGNAL(viewCreated(AppElements_ViewWindow*)),
this, SLOT(onViewCreated(AppElements_ViewWindow*)));
- connect(aViewer, SIGNAL(activated(AppElements_ViewWindow*)),
+ connect(aViewer, SIGNAL(activated(AppElements_ViewWindow*)),
this, SLOT(onActivated(AppElements_ViewWindow*)));
connect(aViewer, SIGNAL(mousePress(AppElements_ViewWindow*, QMouseEvent*)), this,
/// Update current viewer
virtual void update();
- /// Method returns True if the viewer can process editing objects
+ /// Method returns True if the viewer can process editing objects
/// by mouse drugging. If this is impossible thet it has to return False.
virtual bool canDragByMouse() const;
bool aCloc = aResMgr->booleanValue("language", "locale", true);
if (aCloc)
QLocale::setDefault( QLocale::c() );
- else
+ else
QLocale::setDefault( QLocale::system() );
#endif
QString aPath = Config_XMLReader::pluginConfigFile().c_str();
SLOT(onOperationResumed(ModuleBase_Operation*)));
connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
SLOT(onOperationStopped(ModuleBase_Operation*)));
- connect(myOperationMgr, SIGNAL(operationCommitted(ModuleBase_Operation*)),
+ connect(myOperationMgr, SIGNAL(operationCommitted(ModuleBase_Operation*)),
SLOT(onOperationCommitted(ModuleBase_Operation*)));
- connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)),
+ connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)),
SLOT(onOperationAborted(ModuleBase_Operation*)));
#ifndef HAVE_SALOME
Config_Prop::Color, ModelAPI_ResultBody::DEFAULT_COLOR());
Config_PropManager::registerProp("Visualization", "result_group_color", "Group color",
Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_construction_color",
+ Config_PropManager::registerProp("Visualization", "result_construction_color",
"Construction color",
- Config_Prop::Color,
+ Config_Prop::Color,
ModelAPI_ResultConstruction::DEFAULT_COLOR());
Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "body_deflection",
+ Config_PropManager::registerProp("Visualization", "body_deflection",
"Body deflection coefficient",
- Config_Prop::Double,
+ Config_Prop::Double,
ModelAPI_ResultBody::DEFAULT_DEFLECTION());//"0.001");
- Config_PropManager::registerProp("Visualization", "construction_deflection",
+ Config_PropManager::registerProp("Visualization", "construction_deflection",
"Construction deflection coefficient",
- Config_Prop::Double,
+ Config_Prop::Double,
ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());//"0.0001");
if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "face-selection", true))
myMainWindow->show();
updateCommandStatus();
#endif
-
+
onNew();
myViewerProxy->connectViewProxy();
QAction* aAction = salomeConnector()->addDesktopCommand("UNDO_CMD", tr("Undo"),
tr("Undo last command"),
QIcon(":pictures/undo.png"),
- QKeySequence::Undo, false,
+ QKeySequence::Undo, false,
"MEN_DESK_EDIT");
QString aToolBarTitle = tr( "INF_DESK_TOOLBAR_STANDARD" );
salomeConnector()->addActionInToolbar( aAction,aToolBarTitle );
addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList<ActionInfo>&)), SLOT(onRedo(int)));
salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
- //aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"),
+ //aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"),
// tr("Rebuild data objects"),
// QIcon(":pictures/rebuild.png"), QKeySequence(),
// false, "MEN_DESK_EDIT");
//connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRebuild()));
//salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
- aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."),
+ aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."),
tr("Export the current document into a native file"),
QIcon(), QKeySequence(),
false, "MEN_DESK_FILE");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSaveAs()));
- aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Import native..."),
+ aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Import native..."),
tr("Import native file"),
QIcon(), QKeySequence(),
false, "MEN_DESK_FILE");
XGUI_SalomeConnector* aSalomeConnector = salomeConnector();
if (aSalomeConnector->isFeatureOfNested(actionsMgr()->action(aFeatureKind.c_str())))
aHasNested = true;
-#else
+#else
AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str());
if (aCommand && aCommand->button()->additionalButtonWidget())
void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFOperation =
+ ModuleBase_OperationFeature* aFOperation =
dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (!aFOperation)
return;
// update visible state of Preview button
#ifdef HAVE_SALOME
- bool anIsAutoPreview =
+ bool anIsAutoPreview =
mySalomeConnector->featureInfo(aFeatureKind.c_str())->isAutoPreview();
#else
AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
int answer = QMessageBox::question(
desktop(),
- // Title of the dialog which asks user if he wants to save study
+ // Title of the dialog which asks user if he wants to save study
// in existing non-empty folder
tr("Save"),
tr("The directory already contains some files, save anyway?"),
QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
{
QDockWidget* aObjDock = new QDockWidget(theParent);
- aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea |
- Qt::RightDockWidgetArea |
+ aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea |
Qt::BottomDockWidgetArea);
aObjDock->setWindowTitle(tr("Object browser"));
aObjDock->setStyleSheet(
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
myPropertyPanel = new XGUI_PropertyPanel(aDesktop, myOperationMgr);
myPropertyPanel->setupActions(myActionsMgr);
- myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
- Qt::RightDockWidgetArea |
+ myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea |
Qt::BottomDockWidgetArea);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
hidePropertyPanel(); ///<! Invisible by default
for (; aMainIt != aMainLast; aMainIt++) {
FeaturePtr aMainListFeature = aMainIt->first;
std::set<FeaturePtr> aMainRefList = aMainIt->second;
- std::set<FeaturePtr>::const_iterator aRefIt = aMainRefList.begin(),
+ std::set<FeaturePtr>::const_iterator aRefIt = aMainRefList.begin(),
aRefLast = aMainRefList.end();
bool aFeatureOutOfTheList = false;
for (; aRefIt != aRefLast && !aFeatureOutOfTheList; aRefIt++) {
return;
// 1. start operation
- aDescription += "by deleting of " +
+ aDescription += "by deleting of " +
aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
operationMgr()->startOperation(anOpAction);
DocumentPtr aDocument = theObject->document();
std::list<FeaturePtr> anAllFeatures = allFeatures(aDocument);
// find the object iterator
- std::list<FeaturePtr>::iterator aObjectIt =
+ std::list<FeaturePtr>::iterator aObjectIt =
std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject);
if (aObjectIt == anAllFeatures.end())
return aResult;
// find the current feature iterator
- std::list<FeaturePtr>::iterator aCurrentIt =
+ std::list<FeaturePtr>::iterator aCurrentIt =
std::find(anAllFeatures.begin(), anAllFeatures.end(), aDocument->currentFeature(true));
if (aCurrentIt == anAllFeatures.end())
return aResult;
// check the right order
- if (std::distance(aObjectIt, anAllFeatures.end()) <=
+ if (std::distance(aObjectIt, anAllFeatures.end()) <=
std::distance(aCurrentIt, anAllFeatures.end()))
return aResult;
// exclude the object
QObjectPtrList::const_iterator anIt = aObjects.begin(), aLast = aObjects.end();
for (; anIt != aLast && aCanMove; anIt++) {
ObjectPtr aObject = *anIt;
- // 1. Get features placed between selected and current in the document
+ // 1. Get features placed between selected and current in the document
std::list<FeaturePtr> aFeaturesBetween = toCurrentFeatures(aObject);
// if aFeaturesBetween is empty it means wrong order or aObject is the current feature
if (aFeaturesBetween.empty())
aCanMove = false;
else {
std::set<FeaturePtr> aPlacedFeatures(aFeaturesBetween.begin(), aFeaturesBetween.end());
- // 2. Get all reference features to the selected object in the document
+ // 2. Get all reference features to the selected object in the document
std::set<FeaturePtr> aRefFeatures;
ModuleBase_Tools::refsToFeatureInFeatureDocument(aObject, aRefFeatures);
AttributeIntArrayPtr aColorAttr;
// 1. find the current color of the object. This is a color of AIS presentation
- // The objects are iterated until a first valid color is found
+ // The objects are iterated until a first valid color is found
std::vector<int> aColor;
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
return;
if (!abortAllOperations())
- return;
+ return;
// 2. show the dialog to change the value
XGUI_ColorDialog* aDlg = new XGUI_ColorDialog(desktop());
aDlg->setColor(aColor);
foreach(ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
- setColor(aCompsolidResult->subResult(i), !isRandomColor ? aColorResult :
+ setColor(aCompsolidResult->subResult(i), !isRandomColor ? aColorResult :
aDlg->getRandomColor());
}
}
{
AttributeDoublePtr aDoubleAttr;
// 1. find the current color of the object. This is a color of AIS presentation
- // The objects are iterated until a first valid color is found
+ // The objects are iterated until a first valid color is found
double aDeflection = -1;
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
return;
if (!abortAllOperations())
- return;
+ return;
// 2. show the dialog to change the value
XGUI_DeflectionDialog* aDlg = new XGUI_DeflectionDialog(desktop());
aDlg->setDeflection(aDeflection);
foreach(ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
- ResultCompSolidPtr aCompsolidResult =
+ ResultCompSolidPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
//**************************************************************
void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
{
- for (int i = 0; i < theDoc->size(theGroup); i++)
+ for (int i = 0; i < theDoc->size(theGroup); i++)
theDoc->object(theGroup, i)->setDisplayed(true);
//displayObject(theDoc->object(theGroup, i));
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
synchronizeGroupInViewer(aDoc, ModelAPI_ResultGroup::group(), false);
}
-void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
- const std::string& theGroup,
+void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
+ const std::string& theGroup,
bool theUpdateViewer)
{
ObjectPtr aObj;
objectBrowser()->setObjectsSelected(aSelList);
objectBrowser()->blockSignals(aBlocked);
}
- if (aHasHidden)
- QMessageBox::information(desktop(), tr("Find results"),
+ if (aHasHidden)
+ QMessageBox::information(desktop(), tr("Find results"),
tr("Results not found"), QMessageBox::Ok);
}
Q_OBJECT
public:
/// Constructor
- /// \param theConnector a Salome connector object.
+ /// \param theConnector a Salome connector object.
/// Used only if the workshop is launched in Salome environment
XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
virtual ~XGUI_Workshop();
void deleteObjects();
//! Searches for selected features unused in other (not selected) features. If one or several
- //! selected features are found, a warning message proposes to delete them. It contains
+ //! selected features are found, a warning message proposes to delete them. It contains
//! the list of features to be deleted.
void cleanHistory();
/// \param theDoc the document for objects synchronisation
/// \param theGroup the group name
/// \param theUpdateViewer update viewer flag
- void synchronizeGroupInViewer(const DocumentPtr& theDoc,
- const std::string& theGroup,
+ void synchronizeGroupInViewer(const DocumentPtr& theDoc,
+ const std::string& theGroup,
bool theUpdateViewer);
/// Update the property panel content by the XML description of the operation and set the panel
/// features found in the given list
void highlightFeature(const QObjectPtrList& theObjects);
- /// Returns Data Model XML reader which contains information about
+ /// Returns Data Model XML reader which contains information about
/// Data structure configuration
const Config_DataModelReader* dataModelXMLReader() const { return myDataModelXMLReader; }
}
}
else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SELFILTER_LOADED)) {
- std::shared_ptr<Config_SelectionFilterMessage> aMsg =
+ std::shared_ptr<Config_SelectionFilterMessage> aMsg =
std::dynamic_pointer_cast<Config_SelectionFilterMessage>(theMessage);
if (aMsg) {
ModuleBase_FilterFactory* aFactory = myWorkshop->selectionFilters();
aDisplayer->enableUpdateViewer(true);
} else {
//Show error dialog if error message received.
- std::shared_ptr<Events_InfoMessage> anIngfoMsg =
+ std::shared_ptr<Events_InfoMessage> anIngfoMsg =
std::dynamic_pointer_cast<Events_InfoMessage>(theMessage);
if (anIngfoMsg) {
emit errorOccurred(anIngfoMsg);
ObjectPtr aObj = (*aIt);
// Hide the object if it is invalid or concealed one
- bool aHide = !aObj->data() || !aObj->data()->isValid() ||
+ bool aHide = !aObj->data() || !aObj->data()->isValid() ||
aObj->isDisabled() || (!aObj->isDisplayed());
if (!aHide) { // check that this is not hidden result
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
#endif
if (aHide) {
//we should provide objects which are hidden in the viewer, e.g. sketch always should
- // visualizes all sub-features, if some features are to be hidden, sould be proposed may
- // be to removed #1223
+ // visualizes all sub-features, if some features are to be hidden, sould be proposed may
+ // be to removed #1223
// aHiddenObjects.push_back(aObj);
aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed;
#ifdef DEBUG_FEATURE_REDISPLAY
//VSV FitAll updated viewer by itself
if (aDoFitAll)
myWorkshop->viewer()->fitAll();
- else
+ else
aDisplayer->updateViewer();
}
}
// the validity of the data should be checked here in order to avoid display of the objects,
// which were created, then deleted, but flush for the creation event happens after that
// we should not display disabled objects
- bool aHide = !anObject->data()->isValid() ||
+ bool aHide = !anObject->data()->isValid() ||
anObject->isDisabled() ||
!anObject->isDisplayed();
if (!aHide) { // check that this is not hidden result
aHide = !aRes->shape().get() || aRes->shape()->isNull();
}
if (!aHide) {
- // setDisplayed has to be called in order to synchronize internal state of the object
+ // setDisplayed has to be called in order to synchronize internal state of the object
// with list of displayed objects
if (myWorkshop->module()->canDisplayObject(anObject)) {
anObject->setDisplayed(true);
aDisplayed = displayObject(anObject);
if (aDisplayed)
aDoFitAll = aDoFitAll || neededFitAll(anObject, aNbOfShownObjects);
- } else
+ } else
anObject->setDisplayed(false);
}
}
Q_OBJECT
public:
/// Constructor. Used only if the workshop is launched in Salome environment
- /// \param theWorkshop a reference to workshop.
+ /// \param theWorkshop a reference to workshop.
XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop);
virtual ~XGUI_WorkshopListener();
/// Calls the module method of cusomize object for the feature of the current operation
/// Perform cusomize if the force redisplay flag is true or the list of objects contains the
/// current operation feature
- /// \param theObjects a list of objects to find current operation feature
+ /// \param theObjects a list of objects to find current operation feature
/// if forced redisplay is false
/// \param theForceRedisplay a flag to customize object even always
/// \return true if the object is modified