Extensions: GeoFeatureGroup only for GeoFeature

This commit is contained in:
Stefan Tröger
2016-12-10 14:44:13 +01:00
committed by wmayer
parent dfbd6aa237
commit 47ed29fffd
15 changed files with 40 additions and 23 deletions

View File

@@ -45,21 +45,36 @@ EXTENSION_PROPERTY_SOURCE(App::GeoFeatureGroupExtension, App::GroupExtension)
GeoFeatureGroupExtension::GeoFeatureGroupExtension(void)
{
initExtension(GeoFeatureGroupExtension::getExtensionClassTypeId());
EXTENSION_ADD_PROPERTY(Placement,(Base::Placement()));
initExtensionType(GeoFeatureGroupExtension::getExtensionClassTypeId());
}
GeoFeatureGroupExtension::~GeoFeatureGroupExtension(void)
{
}
void GeoFeatureGroupExtension::initExtension(ExtensionContainer* obj) {
if(!obj->isDerivedFrom(App::GeoFeature::getClassTypeId()))
throw Base::Exception("GeoFeatureGroupExtension can only be applied to GeoFeatures");
App::Extension::initExtension(obj);
}
PropertyPlacement& GeoFeatureGroupExtension::placement() {
if(!getExtendedContainer())
throw Base::Exception("GeoFeatureGroupExtension was not applied to GeoFeature");
return static_cast<App::GeoFeature*>(getExtendedContainer())->Placement;
}
void GeoFeatureGroupExtension::transformPlacement(const Base::Placement &transform)
{
// NOTE: Keep in sync with APP::GeoFeature
Base::Placement plm = this->Placement.getValue();
Base::Placement plm = this->placement().getValue();
plm = transform * plm;
this->Placement.setValue(plm);
this->placement().setValue(plm);
}
std::vector<App::DocumentObject*> GeoFeatureGroupExtension::getGeoSubObjects () const {