Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
wmayer 2013-01-09 14:10:49 +01:00
commit f80c88b0cd
4 changed files with 20 additions and 16 deletions

View File

@ -49,6 +49,19 @@ MultiTransform::MultiTransform()
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
{
if (Transformations.isTouched())
@ -58,7 +71,7 @@ short MultiTransform::mustExecute() const
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
// 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::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())))
throw Base::Exception("Transformation features must be subclasses of Transformed");
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(*f);

View File

@ -58,6 +58,9 @@ public:
* Scaled.
*/
const std::list<gp_Trsf> getTransformations(const std::vector<App::DocumentObject*> originals);
protected:
virtual void positionBySupport(void);
};
} //namespace PartDesign

View File

@ -53,16 +53,7 @@ Transformed::Transformed() : rejected(0)
{
ADD_PROPERTY(Originals,(0));
Originals.setSize(0);
}
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);
Placement.StatusBits.set(2, true);
}
void Transformed::positionBySupport(void)

View File

@ -71,17 +71,14 @@ public:
short mustExecute() const;
//@}
void positionBySupport(void);
/** returns a list of the transformations that where rejected during the last execute
* because they did not ovelap with the support
*/
const std::list<gp_Trsf> getRejectedTransformations(void) { return rejected; }
protected:
void onChanged(const App::Property* prop);
virtual void positionBySupport(void);
protected:
std::list<gp_Trsf> rejected;
};