void Object::defaultInitialisation() { // default layers addNewBitmapLayer(); addNewVectorLayer(); // default palette loadDefaultPalette(); }
void Object::defaultInitialisation() { // default layers addNewBitmapLayer(); addNewVectorLayer(); addNewCameraLayer();//TODO Add Camera Layer at beginning for Quick Preview // default palette loadDefaultPalette(); }
bool Object::loadDomElement(QDomElement docElem, QString filePath) { if (docElem.isNull()) { return false; } int layerNumber = -1; QDomNode tag = docElem.firstChild(); bool someRelevantData = false; while (!tag.isNull()) { QDomElement element = tag.toElement(); // try to convert the node to an element. if (!element.isNull()) { if (element.tagName() == "layer") { someRelevantData = true; // --- bitmap layer --- if (element.attribute("type").toInt() == Layer::BITMAP) { addNewBitmapLayer(); layerNumber++; ((LayerBitmap*)(getLayer(layerNumber)))->loadDomElement( element, filePath ); } // --- vector layer --- if (element.attribute("type").toInt() == Layer::VECTOR) { addNewVectorLayer(); layerNumber++; ((LayerVector*)(getLayer(layerNumber)))->loadDomElement( element, filePath ); } // --- sound layer --- if (element.attribute("type").toInt() == Layer::SOUND) { addNewSoundLayer(); layerNumber++; ((LayerSound*)(getLayer(layerNumber)))->loadDomElement( element, filePath ); } // --- camera layer --- if (element.attribute("type").toInt() == Layer::CAMERA) { addNewCameraLayer(); layerNumber++; ((LayerCamera*)(getLayer(layerNumber)))->loadDomElement( element, filePath ); } } } tag = tag.nextSibling(); } qDebug() << " Load object finish. Layer Count=" << getLayerCount(); return someRelevantData; }
bool Object::loadDomElement( QDomElement docElem, QString dataDirPath ) { if ( docElem.isNull() ) { return false; } int layerNumber = -1; bool someRelevantData = false; for ( QDomNode node = docElem.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement element = node.toElement(); // try to convert the node to an element. if ( element.tagName() == "layer" ) { someRelevantData = true; if ( element.attribute( "type" ).toInt() == Layer::BITMAP ) { addNewBitmapLayer(); layerNumber++; getLayer( layerNumber )->loadDomElement( element, dataDirPath ); } else if ( element.attribute( "type" ).toInt() == Layer::VECTOR ) { addNewVectorLayer(); layerNumber++; getLayer( layerNumber )->loadDomElement( element, dataDirPath ); } else if ( element.attribute( "type" ).toInt() == Layer::SOUND ) { addNewSoundLayer(); layerNumber++; getLayer( layerNumber )->loadDomElement( element, dataDirPath ); } else if ( element.attribute( "type" ).toInt() == Layer::CAMERA ) { addNewCameraLayer(); layerNumber++; getLayer( layerNumber )->loadDomElement( element, dataDirPath ); } } } return someRelevantData; }