本文整理汇总了C++中app::Property::Paste方法的典型用法代码示例。如果您正苦于以下问题:C++ Property::Paste方法的具体用法?C++ Property::Paste怎么用?C++ Property::Paste使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::Property
的用法示例。
在下文中一共展示了Property::Paste方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAlias
void Sheet::updateAlias(CellAddress key)
{
std::string alias;
Property * prop = props.getDynamicPropertyByName(key.toString().c_str());
if (!prop)
return;
Cell * cell = getCell(key);
if (cell && cell->getAlias(alias)) {
App::Property * aliasProp = props.getDynamicPropertyByName(alias.c_str());
/* Update or create alias? */
if (aliasProp) {
// Type of alias and property must always be the same
if (aliasProp->getTypeId() != prop->getTypeId()) {
props.removeDynamicProperty(alias.c_str());
aliasProp = 0;
}
}
if (!aliasProp)
aliasProp = props.addDynamicProperty(prop->getTypeId().getName(), alias.c_str(), 0, 0, Prop_ReadOnly | Prop_Transient, true, true);
aliasProp->Paste(*prop);
}
}
示例2: customEvent
void customEvent(QEvent* e)
{
PropertyEvent* pe = static_cast<PropertyEvent*>(e);
std::set<const Gui::ViewProvider*>::iterator it = viewMap.find(pe->view);
// Make sure that the object hasn't been deleted in the meantime (#0001522)
if (it != viewMap.end()) {
viewMap.erase(it);
App::Property* prop = pe->view->getPropertyByName("Proxy");
if (prop && prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) {
prop->Paste(*pe->prop);
}
}
delete pe->prop;
}
示例3: makeCopy
App::DocumentObject* TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool independent) {
App::DocumentObject* copy = nullptr;
// Check for null to avoid segfault
if (!obj)
return copy;
if( independent &&
(obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId()) ||
obj->isDerivedFrom(PartDesign::FeaturePrimitive::getClassTypeId()))) {
//we do know that the created instance is a document object, as obj is one. But we do not know which
//exact type
auto name = std::string("Copy") + std::string(obj->getNameInDocument());
copy = App::GetApplication().getActiveDocument()->addObject(obj->getTypeId().getName(), name.c_str());
//copy over all properties
std::vector<App::Property*> props;
std::vector<App::Property*> cprops;
obj->getPropertyList(props);
copy->getPropertyList(cprops);
auto it = cprops.begin();
for( App::Property* prop : props ) {
//independent copies don't have links and are not attached
if(independent && (
prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId()) ||
prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId()) ||
prop->getTypeId().isDerivedFrom(App::PropertyLinkSub::getClassTypeId()) ||
prop->getTypeId().isDerivedFrom(App::PropertyLinkSubList::getClassTypeId())||
( prop->getGroup() && strcmp(prop->getGroup(),"Attachment")==0) )) {
++it;
continue;
}
App::Property* cprop = *it++;
if( strcmp(prop->getName(), "Label") == 0 ) {
static_cast<App::PropertyString*>(cprop)->setValue(name.c_str());
continue;
}
cprop->Paste(*prop);
//we are a independent copy, therefore no external geometry was copied. WE therefore can delete all
//constraints
if(obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId()))
static_cast<Sketcher::SketchObject*>(copy)->delConstraintsToExternal();
}
}
else {
std::string name;
if(!independent)
name = std::string("Reference");
else
name = std::string("Copy");
name += std::string(obj->getNameInDocument());
std::string entity;
if(!sub.empty())
entity = sub;
Part::PropertyPartShape* shapeProp = nullptr;
// TODO Replace it with commands (2015-09-11, Fat-Zer)
if(obj->isDerivedFrom(Part::Datum::getClassTypeId())) {
copy = App::GetApplication().getActiveDocument()->addObject(
obj->getClassTypeId().getName(), name.c_str() );
//we need to reference the individual datums and make again datums. This is important as
//datum adjust their size dependent on the part size, hence simply copying the shape is
//not enough
long int mode = mmDeactivated;
Part::Datum *datumCopy = static_cast<Part::Datum*>(copy);
if(obj->getTypeId() == PartDesign::Point::getClassTypeId()) {
mode = mm0Vertex;
}
else if(obj->getTypeId() == PartDesign::Line::getClassTypeId()) {
mode = mm1TwoPoints;
}
else if(obj->getTypeId() == PartDesign::Plane::getClassTypeId()) {
mode = mmFlatFace;
}
else
return copy;
// TODO Recheck this. This looks strange in case of independent copy (2015-10-31, Fat-Zer)
if(!independent) {
datumCopy->Support.setValue(obj, entity.c_str());
datumCopy->MapMode.setValue(mode);
}
else if(!entity.empty()) {
datumCopy->Shape.setValue(static_cast<Part::Datum*>(obj)->Shape.getShape().getSubShape(entity.c_str()));
} else {
datumCopy->Shape.setValue(static_cast<Part::Datum*>(obj)->Shape.getValue());
}
}
//.........这里部分代码省略.........