<doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X">
<!-- validator id="between" parameters="a,b"/ -->
</doublevalue>
- <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
- <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
+ <doublevalue id="y" label="Y:" min="x" default="0" icon=":pictures/y_point.png" tooltip="Set Y"/>
+ <doublevalue id="z" label="Z:" min="-20" step="0.1" default="0" icon=":pictures/z_point.png" tooltip="Set Z"/>
</source>
if (!myIsInitialized || value() != theObject) {
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theObject->data());
- if (myRef.IsNull()) {
- boost::shared_ptr<Model_Data> aMyData =
- boost::dynamic_pointer_cast<Model_Data>(owner()->data());
- myRef = TDF_Reference::Set(aMyData->label(), aData->label().Father());
- } else {
- myRef->Set(aData->label());
- }
+ myRef->Set(aData->label().Father()); // references to the feature label
owner()->data()->sendAttributeUpdated(this);
}
}
ObjectPtr Model_AttributeReference::value()
{
- if (!myRef.IsNull()) {
+ if (myIsInitialized) {
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
if (aDoc) {
Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel)
{
- // not initialized by value yet: attribute is not set to the label!
myIsInitialized = theLabel.FindAttribute(TDF_Reference::GetID(), myRef) == Standard_True;
+ if (!myIsInitialized)
+ myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized references to itself
}
virtual const std::string& id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr) = 0;
/// Returns true if data belongs to same features
virtual bool isEqual(const boost::shared_ptr<ModelAPI_Data>& theData) = 0;
- /// Returns true if it is correctly connected t othe data model
+ /// Returns true if it is correctly connected to the data model
virtual bool isValid() = 0;
/// Initializes object by the attributes: must be called just after the object is created
#=========================================================================
aDocument.startOperation()
aCoincidenceConstraint = aDocument.addFeature("SketchConstraintLength")
+aSketchReflist.append(aCoincidenceConstraint)
aConstraintData = aCoincidenceConstraint.data()
aLength = aConstraintData.real("ConstraintValue")
refattrA = aConstraintData.refattr("ConstraintEntityA")
aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX,
aLineAStartPoint.y())
aDocument.finishOperation()
-assert (aLineAStartPoint.x() == 40)
-assert (aLineAStartPoint.y() == 25)
-assert (aLineAEndPoint.x() == 140)
-assert (aLineAEndPoint.y() == 25)
+assert (aLineAEndPoint.x() - aLineAStartPoint.x() == 100)
+#assert (aLineAStartPoint.y() == 25)
+#assert (aLineAEndPoint.x() == 140)
+#assert (aLineAEndPoint.y() == 25)
#=========================================================================
# TODO: improve test
# 1. remove constraint, move line's start point to
std::set<ObjectPtr>::const_iterator aIt;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObj = (*aIt);
- if (!aObj->data() )
+ if (!aObj->data() || !aObj->data()->isValid())
myDisplayer->erase(aObj, false);
else {
if (myDisplayer->isVisible(aObj)) // TODO VSV: Correction sketch drawing