/*************************************************************************** * Copyright (c) 2023 Abdullah Tahiri #include #include #include #include "PropertyVisualLayerList.h" using namespace App; using namespace Base; using namespace std; using namespace SketcherGui; TYPESYSTEM_SOURCE(SketcherGui::PropertyVisualLayerList , App::PropertyLists) //************************************************************************** // Construction/Destruction PropertyVisualLayerList::PropertyVisualLayerList() = default; PropertyVisualLayerList::~PropertyVisualLayerList() = default; //************************************************************************** // Base class implementer PyObject *PropertyVisualLayerList::getPyObject() { THROWM(Base::NotImplementedError, "PropertyVisualLayerList has no python counterpart"); } VisualLayer PropertyVisualLayerList::getPyValue(PyObject *item) const { (void) item; THROWM(Base::NotImplementedError, "PropertyVisualLayerList has no python counterpart"); } void PropertyVisualLayerList::Save (Base::Writer &writer) const { writer.Stream() << writer.ind() << "" << endl; writer.incInd(); for (int i = 0; i < getSize(); i++) { _lValueList[i].Save(writer); } writer.decInd(); writer.Stream() << writer.ind() << "" << endl ; } void PropertyVisualLayerList::Restore(Base::XMLReader &reader) { reader.readElement("VisualLayerList"); // get the value of my attribute int count = reader.getAttributeAsInteger("count"); std::vector layers; layers.reserve(count); for (int i = 0; i < count; i++) { VisualLayer visualLayer; visualLayer.Restore(reader); layers.push_back(std::move(visualLayer)); } reader.readEndElement("VisualLayerList"); setValues(std::move(layers)); } Property *PropertyVisualLayerList::Copy() const { PropertyVisualLayerList *p= new PropertyVisualLayerList(); p->_lValueList = _lValueList; return p; } void PropertyVisualLayerList::Paste(const Property &from) { setValues(dynamic_cast(from)._lValueList); } unsigned int PropertyVisualLayerList::getMemSize () const { return static_cast(_lValueList.size() * sizeof(VisualLayer)); }