本文整理汇总了C++中app::PropertyContainer::isDerivedFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyContainer::isDerivedFrom方法的具体用法?C++ PropertyContainer::isDerivedFrom怎么用?C++ PropertyContainer::isDerivedFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::PropertyContainer
的用法示例。
在下文中一共展示了PropertyContainer::isDerivedFrom方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotChangePropertyEditor
void PropertyView::slotChangePropertyEditor(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->updatetEditorMode(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->updatetEditorMode(prop);
}
}
示例2: slotRemoveDynamicProperty
void PropertyView::slotRemoveDynamicProperty(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->removeProperty(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->removeProperty(prop);
}
}
示例3: slotAppendDynamicProperty
void PropertyView::slotAppendDynamicProperty(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent->isHidden(&prop) || prop.testStatus(App::Property::Hidden))
return;
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->appendProperty(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->appendProperty(prop);
}
}
示例4: SaveDocFile
void PropertyPartShape::SaveDocFile (Base::Writer &writer) const
{
// If the shape is empty we simply store nothing. The file size will be 0 which
// can be checked when reading in the data.
if (_Shape._Shape.IsNull())
return;
// NOTE: Cleaning the triangulation may cause problems on some algorithms like BOP
// Before writing to the project we clean all triangulation data to save memory
BRepBuilderAPI_Copy copy(_Shape._Shape);
const TopoDS_Shape& myShape = copy.Shape();
BRepTools::Clean(myShape); // remove triangulation
// create a temporary file and copy the content to the zip stream
// once the tmp. filename is known use always the same because otherwise
// we may run into some problems on the Linux platform
static Base::FileInfo fi(Base::FileInfo::getTempFileName());
if (!BRepTools::Write(myShape,(const Standard_CString)fi.filePath().c_str())) {
// Note: Do NOT throw an exception here because if the tmp. file could
// not be created we should not abort.
// We only print an error message but continue writing the next files to the
// stream...
App::PropertyContainer* father = this->getContainer();
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
Base::Console().Error("Shape of '%s' cannot be written to BRep file '%s'\n",
obj->Label.getValue(),fi.filePath().c_str());
}
else {
Base::Console().Error("Cannot save BRep file '%s'\n", fi.filePath().c_str());
}
}
Base::ifstream file(fi, std::ios::in | std::ios::binary);
if (file){
unsigned long ulSize = 0;
std::streambuf* buf = file.rdbuf();
if (buf) {
unsigned long ulCurr;
ulCurr = buf->pubseekoff(0, std::ios::cur, std::ios::in);
ulSize = buf->pubseekoff(0, std::ios::end, std::ios::in);
buf->pubseekoff(ulCurr, std::ios::beg, std::ios::in);
}
// read in the ASCII file and write back to the stream
std::strstreambuf sbuf(ulSize);
file >> &sbuf;
writer.Stream() << &sbuf;
}
file.close();
// remove temp file
fi.deleteFile();
}
示例5: RestoreDocFile
void PropertyPartShape::RestoreDocFile(Base::Reader &reader)
{
Base::FileInfo brep(reader.getFileName());
if (brep.hasExtension("bin")) {
TopoShape shape;
shape.importBinary(reader);
setValue(shape);
}
else {
bool direct = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Mod/Part/General")->GetBool("DirectAccess", true);
if (!direct) {
BRep_Builder builder;
// create a temporary file and copy the content from the zip stream
Base::FileInfo fi(App::Application::getTempFileName());
// read in the ASCII file and write back to the file stream
Base::ofstream file(fi, std::ios::out | std::ios::binary);
unsigned long ulSize = 0;
if (reader) {
std::streambuf* buf = file.rdbuf();
reader >> buf;
file.flush();
ulSize = buf->pubseekoff(0, std::ios::cur, std::ios::in);
}
file.close();
// Read the shape from the temp file, if the file is empty the stored shape was already empty.
// If it's still empty after reading the (non-empty) file there must occurred an error.
TopoDS_Shape shape;
if (ulSize > 0) {
if (!BRepTools::Read(shape, (Standard_CString)fi.filePath().c_str(), builder)) {
// Note: Do NOT throw an exception here because if the tmp. created file could
// not be read it's NOT an indication for an invalid input stream 'reader'.
// We only print an error message but continue reading the next files from the
// stream...
App::PropertyContainer* father = this->getContainer();
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
Base::Console().Error("BRep file '%s' with shape of '%s' seems to be empty\n",
fi.filePath().c_str(),obj->Label.getValue());
}
else {
Base::Console().Warning("Loaded BRep file '%s' seems to be empty\n", fi.filePath().c_str());
}
}
}
// delete the temp file
fi.deleteFile();
setValue(shape);
}
else {
示例6: SaveDocFile
void PropertyPartShape::SaveDocFile (Base::Writer &writer) const
{
// If the shape is empty we simply store nothing. The file size will be 0 which
// can be checked when reading in the data.
if (_Shape.getShape().IsNull())
return;
TopoDS_Shape myShape = _Shape.getShape();
if (writer.getMode("BinaryBrep")) {
TopoShape shape;
shape.setShape(myShape);
shape.exportBinary(writer.Stream());
}
else {
bool direct = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Mod/Part/General")->GetBool("DirectAccess", true);
if (!direct) {
// create a temporary file and copy the content to the zip stream
// once the tmp. filename is known use always the same because otherwise
// we may run into some problems on the Linux platform
static Base::FileInfo fi(App::Application::getTempFileName());
if (!BRepTools_Write(myShape,(Standard_CString)fi.filePath().c_str())) {
// Note: Do NOT throw an exception here because if the tmp. file could
// not be created we should not abort.
// We only print an error message but continue writing the next files to the
// stream...
App::PropertyContainer* father = this->getContainer();
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
Base::Console().Error("Shape of '%s' cannot be written to BRep file '%s'\n",
obj->Label.getValue(),fi.filePath().c_str());
}
else {
Base::Console().Error("Cannot save BRep file '%s'\n", fi.filePath().c_str());
}
std::stringstream ss;
ss << "Cannot save BRep file '" << fi.filePath() << "'";
writer.addError(ss.str());
}
Base::ifstream file(fi, std::ios::in | std::ios::binary);
if (file) {
//unsigned long ulSize = 0;
std::streambuf* buf = file.rdbuf();
//if (buf) {
// unsigned long ulCurr;
// ulCurr = buf->pubseekoff(0, std::ios::cur, std::ios::in);
// ulSize = buf->pubseekoff(0, std::ios::end, std::ios::in);
// buf->pubseekoff(ulCurr, std::ios::beg, std::ios::in);
//}
// read in the ASCII file and write back to the stream
//std::strstreambuf sbuf(ulSize);
//file >> &sbuf;
//writer.Stream() << &sbuf;
writer.Stream() << buf;
}
file.close();
// remove temp file
fi.deleteFile();
}
else {
BRepTools_Write(myShape, writer.Stream());
}
}
}