本文整理汇总了C++中app::Document::recomputeFeature方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::recomputeFeature方法的具体用法?C++ Document::recomputeFeature怎么用?C++ Document::recomputeFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::Document
的用法示例。
在下文中一共展示了Document::recomputeFeature方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMsg
bool SheetView::onMsg(const char *pMsg, const char **ppReturn)
{
if(strcmp("Undo",pMsg) == 0 ) {
getGuiDocument()->undo(1);
App::Document* doc = getAppDocument();
if (doc)
doc->recomputeFeature(sheet);
return true;
}
else if(strcmp("Redo",pMsg) == 0 ) {
getGuiDocument()->redo(1);
App::Document* doc = getAppDocument();
if (doc)
doc->recomputeFeature(sheet);
return true;
}
else if (strcmp("Save",pMsg) == 0) {
getGuiDocument()->save();
return true;
}
else if (strcmp("SaveAs",pMsg) == 0) {
getGuiDocument()->saveAs();
return true;
}
else
return false;
}
示例2: insert
Py::Object insert(const Py::Tuple& args)
{
char* Name;
const char* DocName = 0;
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
App::Document *pcDoc = 0;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
}
Base::FileInfo file(EncodedName.c_str());
try {
std::unique_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.release());
pcFeature->purgeTouched();
}
catch (Base::Exception&) {
#ifdef FC_USE_VTK
if (FemPostPipeline::canRead(file)) {
FemPostPipeline *pcFeature = static_cast<FemPostPipeline *>
(pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->read(file);
pcFeature->touch();
pcDoc->recomputeFeature(pcFeature);
}
else {
throw;
}
#else
throw;
#endif
}
return Py::None();
}
示例3: open
Py::Object open(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
try {
Base::Console().Log("Open in Points with %s",EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// extract ending
if (file.extension().empty())
throw Py::RuntimeError("No file extension");
std::unique_ptr<Reader> reader;
if (file.hasExtension("asc")) {
reader.reset(new AscReader);
}
#ifdef HAVE_PCL_IO
else if (file.hasExtension("ply")) {
reader.reset(new PlyReader);
}
else if (file.hasExtension("pcd")) {
reader.reset(new PcdReader);
}
#endif
else {
throw Py::RuntimeError("Unsupported file extension");
}
reader->read(EncodedName);
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
Points::Feature *pcFeature = 0;
if (reader->hasProperties()) {
// Scattered or structured points?
if (reader->isStructured()) {
pcFeature = new Points::StructuredCustom();
App::PropertyInteger* width = static_cast<App::PropertyInteger*>
(pcFeature->getPropertyByName("Width"));
if (width) {
width->setValue(reader->getWidth());
}
App::PropertyInteger* height = static_cast<App::PropertyInteger*>
(pcFeature->getPropertyByName("Height"));
if (height) {
height->setValue(reader->getHeight());
}
}
else {
pcFeature = new Points::FeatureCustom();
}
pcFeature->Points.setValue(reader->getPoints());
// add gray values
if (reader->hasIntensities()) {
Points::PropertyGreyValueList* prop = static_cast<Points::PropertyGreyValueList*>
(pcFeature->addDynamicProperty("Points::PropertyGreyValueList", "Intensity"));
if (prop) {
prop->setValues(reader->getIntensities());
}
}
// add colors
if (reader->hasColors()) {
App::PropertyColorList* prop = static_cast<App::PropertyColorList*>
(pcFeature->addDynamicProperty("App::PropertyColorList", "Color"));
if (prop) {
prop->setValues(reader->getColors());
}
}
// add normals
if (reader->hasNormals()) {
Points::PropertyNormalList* prop = static_cast<Points::PropertyNormalList*>
(pcFeature->addDynamicProperty("Points::PropertyNormalList", "Normal"));
if (prop) {
prop->setValues(reader->getNormals());
}
}
// delayed adding of the points feature
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
pcDoc->recomputeFeature(pcFeature);
pcFeature->purgeTouched();
}
else {
if (reader->isStructured()) {
Structured* structured = new Points::Structured();
structured->Width.setValue(reader->getWidth());
structured->Height.setValue(reader->getHeight());
pcFeature = structured;
}
else {
pcFeature = new Points::Feature();
}
// delayed adding of the points feature
//.........这里部分代码省略.........
示例4: open
Py::Object open(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
try {
Base::Console().Log("Open in Points with %s",EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// extract ending
if (file.extension().empty())
throw Py::RuntimeError("No file extension");
if (file.hasExtension("asc")) {
// create new document and add Import feature
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
Points::Feature *pcFeature = (Points::Feature *)pcDoc->addObject("Points::Feature", file.fileNamePure().c_str());
Points::PointKernel pkTemp;
pkTemp.load(EncodedName.c_str());
pcFeature->Points.setValue( pkTemp );
}
#ifdef HAVE_PCL_IO
else if (file.hasExtension("ply")) {
PlyReader reader;
reader.read(EncodedName);
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
if (reader.hasProperties()) {
Points::FeatureCustom *pcFeature = new Points::FeatureCustom();
pcFeature->Points.setValue(reader.getPoints());
// add gray values
if (reader.hasIntensities()) {
Points::PropertyGreyValueList* prop = static_cast<Points::PropertyGreyValueList*>
(pcFeature->addDynamicProperty("Points::PropertyGreyValueList", "Intensity"));
if (prop) {
prop->setValues(reader.getIntensities());
}
}
// add colors
if (reader.hasColors()) {
App::PropertyColorList* prop = static_cast<App::PropertyColorList*>
(pcFeature->addDynamicProperty("App::PropertyColorList", "Color"));
if (prop) {
prop->setValues(reader.getColors());
}
}
// add normals
if (reader.hasNormals()) {
Points::PropertyNormalList* prop = static_cast<Points::PropertyNormalList*>
(pcFeature->addDynamicProperty("Points::PropertyNormalList", "Normal"));
if (prop) {
prop->setValues(reader.getNormals());
}
}
// delayed adding of the points feature
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
pcDoc->recomputeFeature(pcFeature);
}
else {
Points::Feature *pcFeature = static_cast<Points::Feature*>
(pcDoc->addObject("Points::Feature", file.fileNamePure().c_str()));
pcFeature->Points.setValue(reader.getPoints());
pcDoc->recomputeFeature(pcFeature);
}
}
#endif
else {
throw Py::RuntimeError("Unsupported file extension");
}
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
return Py::None();
}