Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
This commit is contained in:
commit
f80c88b0cd
|
@ -49,6 +49,19 @@ MultiTransform::MultiTransform()
|
||||||
Transformations.setSize(0);
|
Transformations.setSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultiTransform::positionBySupport(void)
|
||||||
|
{
|
||||||
|
PartDesign::Transformed::positionBySupport();
|
||||||
|
std::vector<App::DocumentObject*> transFeatures = Transformations.getValues();
|
||||||
|
for (std::vector<App::DocumentObject*>::const_iterator f = transFeatures.begin();
|
||||||
|
f != transFeatures.end(); f++) {
|
||||||
|
if (!((*f)->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId())))
|
||||||
|
throw Base::Exception("Transformation features must be subclasses of Transformed");
|
||||||
|
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(*f);
|
||||||
|
transFeature->Placement.setValue(this->Placement.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
short MultiTransform::mustExecute() const
|
short MultiTransform::mustExecute() const
|
||||||
{
|
{
|
||||||
if (Transformations.isTouched())
|
if (Transformations.isTouched())
|
||||||
|
@ -58,7 +71,7 @@ short MultiTransform::mustExecute() const
|
||||||
|
|
||||||
const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<App::DocumentObject*> originals)
|
const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<App::DocumentObject*> originals)
|
||||||
{
|
{
|
||||||
std::vector<App::DocumentObject*> transformationFeatures = Transformations.getValues();
|
std::vector<App::DocumentObject*> transFeatures = Transformations.getValues();
|
||||||
|
|
||||||
// Find centre of gravity of first original
|
// Find centre of gravity of first original
|
||||||
// FIXME: This method will NOT give the expected result for more than one original!
|
// FIXME: This method will NOT give the expected result for more than one original!
|
||||||
|
@ -81,7 +94,7 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
|
||||||
std::list<gp_Pnt> cogs;
|
std::list<gp_Pnt> cogs;
|
||||||
std::vector<App::DocumentObject*>::const_iterator f;
|
std::vector<App::DocumentObject*>::const_iterator f;
|
||||||
|
|
||||||
for (f = transformationFeatures.begin(); f != transformationFeatures.end(); f++) {
|
for (f = transFeatures.begin(); f != transFeatures.end(); f++) {
|
||||||
if (!((*f)->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId())))
|
if (!((*f)->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId())))
|
||||||
throw Base::Exception("Transformation features must be subclasses of Transformed");
|
throw Base::Exception("Transformation features must be subclasses of Transformed");
|
||||||
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(*f);
|
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(*f);
|
||||||
|
|
|
@ -58,6 +58,9 @@ public:
|
||||||
* Scaled.
|
* Scaled.
|
||||||
*/
|
*/
|
||||||
const std::list<gp_Trsf> getTransformations(const std::vector<App::DocumentObject*> originals);
|
const std::list<gp_Trsf> getTransformations(const std::vector<App::DocumentObject*> originals);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void positionBySupport(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace PartDesign
|
} //namespace PartDesign
|
||||||
|
|
|
@ -53,16 +53,7 @@ Transformed::Transformed() : rejected(0)
|
||||||
{
|
{
|
||||||
ADD_PROPERTY(Originals,(0));
|
ADD_PROPERTY(Originals,(0));
|
||||||
Originals.setSize(0);
|
Originals.setSize(0);
|
||||||
}
|
Placement.StatusBits.set(2, true);
|
||||||
|
|
||||||
void Transformed::onChanged(const App::Property* prop)
|
|
||||||
{
|
|
||||||
if (prop == &Originals) {
|
|
||||||
// if attached then mark it as read-only
|
|
||||||
this->Placement.StatusBits.set(2, Originals.getSize() != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
PartDesign::Feature::onChanged(prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transformed::positionBySupport(void)
|
void Transformed::positionBySupport(void)
|
||||||
|
|
|
@ -71,17 +71,14 @@ public:
|
||||||
short mustExecute() const;
|
short mustExecute() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
void positionBySupport(void);
|
|
||||||
|
|
||||||
/** returns a list of the transformations that where rejected during the last execute
|
/** returns a list of the transformations that where rejected during the last execute
|
||||||
* because they did not ovelap with the support
|
* because they did not ovelap with the support
|
||||||
*/
|
*/
|
||||||
const std::list<gp_Trsf> getRejectedTransformations(void) { return rejected; }
|
const std::list<gp_Trsf> getRejectedTransformations(void) { return rejected; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onChanged(const App::Property* prop);
|
virtual void positionBySupport(void);
|
||||||
|
|
||||||
protected:
|
|
||||||
std::list<gp_Trsf> rejected;
|
std::list<gp_Trsf> rejected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user