00001 00002 #include "PreCompiled.h" 00003 00004 #include "Gui/SelectionObject.h" 00005 #include "App/Document.h" 00006 #include "App/DocumentObject.h" 00007 #include "App/Application.h" 00008 00009 // inclusion of the generated files (generated out of SelectionObjectPy.xml) 00010 #include "SelectionObjectPy.h" 00011 #include "SelectionObjectPy.cpp" 00012 00013 using namespace Gui; 00014 00015 // returns a string which represents the object e.g. when printed in python 00016 std::string SelectionObjectPy::representation(void) const 00017 { 00018 return "<SelectionObject>"; 00019 } 00020 00021 00022 00023 PyObject* SelectionObjectPy::remove(PyObject * /*args*/) 00024 { 00025 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); 00026 return 0; 00027 } 00028 00029 PyObject* SelectionObjectPy::isA(PyObject * /*args*/) 00030 { 00031 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); 00032 return 0; 00033 } 00034 00035 00036 00037 Py::String SelectionObjectPy::getObjectName(void) const 00038 { 00039 return Py::String(getSelectionObjectPtr()->getFeatName()); 00040 } 00041 00042 Py::List SelectionObjectPy::getSubElementNames(void) const 00043 { 00044 Py::List temp; 00045 std::vector<std::string> objs = getSelectionObjectPtr()->getSubNames(); 00046 00047 for(std::vector<std::string>::const_iterator it= objs.begin();it!=objs.end();++it) 00048 temp.append(Py::String(*it)); 00049 00050 return temp; 00051 } 00052 00053 Py::String SelectionObjectPy::getFullName(void) const 00054 { 00055 std::string buf; 00056 //buf = getSelectionObjectPtr()->getDocName(); 00057 //buf += "."; 00058 //buf += getSelectionObjectPtr()->getFeatName(); 00059 //if(getSelectionObjectPtr()->getSubName()){ 00060 // buf += "."; 00061 // buf += getSelectionObjectPtr()->getSubName(); 00062 //} 00063 return Py::String(buf.c_str()); 00064 } 00065 00066 Py::String SelectionObjectPy::getDocumentName(void) const 00067 { 00068 return Py::String(getSelectionObjectPtr()->getDocName()); 00069 } 00070 00071 Py::Object SelectionObjectPy::getDocument(void) const 00072 { 00073 return Py::Object(getSelectionObjectPtr()->getObject()->getDocument()->getPyObject(), true); 00074 } 00075 00076 Py::Object SelectionObjectPy::getObject(void) const 00077 { 00078 return Py::Object(getSelectionObjectPtr()->getObject()->getPyObject(), true); 00079 } 00080 00081 Py::List SelectionObjectPy::getSubObjects(void) const 00082 { 00083 Py::List temp; 00084 std::vector<PyObject *> objs = getSelectionObjectPtr()->getObject()->getPySubObjects(getSelectionObjectPtr()->getSubNames()); 00085 for(std::vector<PyObject *>::const_iterator it= objs.begin();it!=objs.end();++it) 00086 temp.append(Py::Object(*it,true)); 00087 return temp; 00088 } 00089 00090 Py::Boolean SelectionObjectPy::getHasSubObjects(void) const 00091 { 00092 return Py::Boolean(getSelectionObjectPtr()->hasSubNames()); 00093 } 00094 00095 PyObject *SelectionObjectPy::getCustomAttributes(const char* /*attr*/) const 00096 { 00097 return 0; 00098 } 00099 00100 int SelectionObjectPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) 00101 { 00102 return 0; 00103 } 00104 00105