// **************************************************************************** // // Function Name: REditHeadlineAction::Do( ) // // Description: Perform the action. // // Returns: TRUE: this does nothing other than set the state. // // Exceptions: None // // **************************************************************************** // BOOLEAN REditHeadlineAction::Do( ) { if ( !m_fHeadlineChanged ) return FALSE; HeadlineDataStruct currentHeadlineData; m_pHeadlineDocument->GetHeadlineData( ¤tHeadlineData ); m_pHeadlineDocument->SetHeadlineData( &m_HeadlineDataStruct ); m_HeadlineDataStruct = currentHeadlineData; // If this is a banner headline, we need to resize ourself if( m_pHeadlineDocument->GetComponentType( ) == kSpecialHeadlineComponent ) { // Get the headline size RRealSize graphicSize = m_pHeadlineDocument->HeadlineObject( ).GetGraphic( )->GetGraphicSize( ); // Make the component that size static_cast<RComponentView*>( m_pHeadlineDocument->GetActiveView( ) )->Resize( graphicSize ); } // Invalidate the render cache static_cast<RComponentView*>( m_pHeadlineDocument->GetActiveView( ) )->InvalidateRenderCache( ); // Notify our parent that we were editted RDocument* pParentDocument = m_pHeadlineDocument->GetParentDocument( ); if( pParentDocument ) pParentDocument->XUpdateAllViews( kLayoutChanged, 0 ); return RUndoableAction::Do( ); }
RVector RSnapIntersection::snap( const RVector& position, RGraphicsView& view, double range) { entityIds.clear(); RDocument* document = view.getDocument(); if (document==NULL) { lastSnap = position; return lastSnap; } if (RMath::isNaN(range)) { int rangePixels = RSettings::getSnapRange(); range = view.mapDistanceFromView(rangePixels); } RBox queryBox(position, range); QMap<REntity::Id, QSet<int> > ids = document->queryIntersectedShapesXY( queryBox, true /*false?*/, true, RBlock::INVALID_ID, QList<RS::EntityType>() << RS::EntityHatch); return snap(position, view, ids, queryBox); }
/** * Sets the current entity to the given entity and calls \ref exportEntity(). * Note that entity is a temporary clone. */ void RExporter::exportEntity(REntity& entity, bool preview, bool allBlocks, bool forceSelected) { RDocument* doc = entity.getDocument(); if (doc==NULL) { doc = document; } // entity not on current block and allBlocks==false, break: if (!allBlocks && doc->getCurrentBlockId()!=entity.getBlockId()) { //unexportEntity(entity.getId()); return; } entityStack.push(&entity); // find layer of the current entity QSharedPointer<RLayer> layer; if (layerSource!=NULL) { RLayer::Id layerId = entity.getLayerId(); layer = layerSource->queryLayerDirect(layerId); Q_ASSERT(!layer.isNull()); } else { layer = doc->queryLayerDirect(entity.getLayerId()); if (layer.isNull()) { qDebug() << "Document: " << *doc; qDebug() << "Layer ID: " << entity.getLayerId(); Q_ASSERT_X(false, "RExporter::exportEntity", "layer is NULL"); } } if (!layer.isNull()) { currentLayer = layer.data(); } // find block reference of the current entity, ignore this entity: bool blockRefOrViewportSet = false; // check if this entity is a block reference: RBlockReferenceEntity* blockRef = dynamic_cast<RBlockReferenceEntity*>(&entity); if (blockRef!=NULL) { blockRefStack.push(blockRef); blockRefOrViewportSet = true; } // check if this entity is a viewport: RViewportEntity* viewPort = dynamic_cast<RViewportEntity*>(&entity); if (viewPort!=NULL) { blockRefStack.push(viewPort); blockRefOrViewportSet = true; } startEntity(/* topLevelEntity = */ blockRefOrViewportSet || blockRefStack.isEmpty()); exportCurrentEntity(preview, forceSelected); endEntity(); if (blockRefOrViewportSet) { blockRefStack.pop(); //blockRefBS.clear(); } currentLayer = NULL; entityStack.pop(); }
bool RBlockReferenceEntity::setProperty(RPropertyTypeId propertyTypeId, const QVariant& value) { bool ret = REntity::setProperty(propertyTypeId, value); ret = ret || RObject::setMember(data.position.x, value, PropertyPositionX == propertyTypeId); ret = ret || RObject::setMember(data.position.y, value, PropertyPositionY == propertyTypeId); ret = ret || RObject::setMember(data.position.z, value, PropertyPositionZ == propertyTypeId); ret = ret || RObject::setMember(data.scaleFactors.x, value, PropertyScaleX == propertyTypeId && fabs(value.toDouble())>RS::PointTolerance); ret = ret || RObject::setMember(data.scaleFactors.y, value, PropertyScaleY == propertyTypeId && fabs(value.toDouble())>RS::PointTolerance); ret = ret || RObject::setMember(data.scaleFactors.z, value, PropertyScaleZ == propertyTypeId && fabs(value.toDouble())>RS::PointTolerance); ret = ret || RObject::setMember(data.rotation, value, PropertyRotation == propertyTypeId); if (propertyTypeId == PropertyReferencedBlock) { if (value.type() == QVariant::Int || value.type() == QVariant::LongLong) { ret = ret || RObject::setMember( getData().referencedBlockId, value.toInt(), true); } else if (value.type() == QVariant::String) { RDocument* document = getData().getDocument(); if (document != NULL) { ret = ret || RObject::setMember(getData().referencedBlockId, document->getBlockId(value.toString()), true); } } } if (ret) { data.update(); } return ret; }
RVector RSnapEntityBase::snap( const RVector& position, RGraphicsView& view, double range) { entityIds.clear(); RDocument* document = view.getDocument(); lastSnap = RVector::invalid; if (document==NULL) { lastSnap = position; lastSnap.valid = false; return lastSnap; } if (RMath::isNaN(range)) { int rangePixels = RSettings::getSnapRange(); range = view.mapDistanceFromView(rangePixels); } RBox queryBox(position, range); QSet<REntity::Id> candidates = document->queryIntersectedEntitiesXY( queryBox, true, true, RBlock::INVALID_ID); return snap(position, view, candidates, queryBox); }
bool RLeaderEntity::setProperty(RPropertyTypeId propertyTypeId, const QVariant& value, RTransaction* transaction) { bool ret = REntity::setProperty(propertyTypeId, value, transaction); if (PropertyArrowHead == propertyTypeId) { if (value.toBool()==false || data.canHaveArrowHead()) { ret = ret || RObject::setMember(data.arrowHead, value); } } if (propertyTypeId == PropertyDimLeaderBlock) { if (value.type() == QVariant::Int || value.type() == QVariant::LongLong) { ret = ret || RObject::setMember( getData().dimLeaderBlockId, value.toInt(), true); } else if (value.type() == QVariant::String) { RDocument* document = getData().getDocument(); if (document != NULL) { ret = ret || RObject::setMember(getData().dimLeaderBlockId, document->getBlockId(value.toString()), true); } } } // ret = ret || RObject::setMember(data.arrowHead, value, PropertyArrowHead == propertyTypeId); ret = ret || RObject::setMemberX(data.vertices, value, PropertyVertexNX == propertyTypeId); ret = ret || RObject::setMemberY(data.vertices, value, PropertyVertexNY == propertyTypeId); ret = ret || RObject::setMemberZ(data.vertices, value, PropertyVertexNZ == propertyTypeId); return ret; }
// **************************************************************************** // // Function Name: REditComponentAttributesAction::Do( ) // // Description: Does the action // // Returns: TRUE if the action was sucessful // // Exceptions: None // // **************************************************************************** // BOOLEAN REditComponentAttributesAction::Do( ) { // Only do the action if something changed if( !m_fAttributesChanged ) return FALSE; // Call the base method to setup the state properly RUndoableAction::Do( ); // Invalidate the selection m_pCurrentSelection->Invalidate( ); // Set the new attributes into the component document m_pComponentDocument->SetComponentAttributes( m_NewComponentAttributes ); // If the Z-Layer has changed, remove the component and re-insert it if( m_OldComponentAttributes.GetZLayer( ) != m_NewComponentAttributes.GetZLayer( ) ) { // Get the parent document RDocument* pParentDocument = m_pCurrentSelection->GetView( )->GetRDocument( ); // Remove the component pParentDocument->RemoveComponent( m_pComponentDocument ); // Re-Add it pParentDocument->AddComponent( m_pComponentDocument ); } return TRUE; }
RTransaction RMoveReferencePointOperation::apply(RDocument& document, bool preview) const { Q_UNUSED(preview) RTransaction transaction(document.getStorage(), text); transaction.setGroup(transactionGroup); QSet<REntity::Id> selectedEntities = document.querySelectedEntities(); QSet<REntity::Id>::iterator it; for (it=selectedEntities.begin(); it!=selectedEntities.end(); it++) { QSharedPointer<REntity> entity = document.queryEntity(*it); if (entity.isNull()) { continue; } // apply operation to cloned entity: bool modified = entity->moveReferencePoint(referencePoint, targetPoint); if (modified) { transaction.addObject(entity, false); } } transaction.end(); return transaction; }
RTransaction RChangePropertyOperation::apply(RDocument& document, bool preview) const { Q_UNUSED(preview) RTransaction transaction(document.getStorage(), text); // always allow property changes (e.g. move entity to hidden layer) transaction.setAllowInvisible(true); transaction.setGroup(transactionGroup); QVariant val = value; // optimization: change layer ID instead of changing layer name: if (propertyTypeId==REntity::PropertyLayer && value.type() == QVariant::String) { val = QVariant(document.getLayerId(value.toString())); } //RDebug::startTimer(); //qDebug() << "filter: " << entityTypeFilter; QSet<RObject::Id> selectedObjects = document.queryPropertyEditorObjects(); QSet<RObject::Id>::iterator it; for (it = selectedObjects.begin(); it != selectedObjects.end(); it++) { QSharedPointer<RObject> obj = document.queryObject(*it); if (obj.isNull()) { continue; } if (entityTypeFilter!=RS::EntityAll) { // special filter for block references and attributes: if (entityTypeFilter==RS::EntityBlockRefAttr) { if (obj->getType()!=RS::EntityBlockRef && obj->getType()!=RS::EntityAttribute) { continue; } } else { if (entityTypeFilter!=obj->getType()) { continue; } } } // apply operation to object: bool modified = obj->setProperty(propertyTypeId, val, &transaction); if (modified) { transaction.addObject(obj, false, false, QSet<RPropertyTypeId>() << propertyTypeId); } } transaction.end(); //RDebug::stopTimer("RChangePropertyOperation::apply"); return transaction; }
bool RGraphicsView::isGridVisible() const { if (gridVisible==-1) { RDocument* doc = getDocument(); if (doc==NULL) { return true; } gridVisible = (int)doc->getVariable(QString("Grid/DisplayGrid0%1").arg(viewportNumber), true, true).toBool(); } return gridVisible; }
QPair<QVariant, RPropertyAttributes> REntity::getProperty( RPropertyTypeId propertyTypeId, bool humanReadable, bool noAttributes) { if (propertyTypeId == PropertyType) { return qMakePair(QVariant(RS::EntityUnknown), RPropertyAttributes()); } else if (propertyTypeId == PropertyBlock) { return qMakePair(QVariant(getData().getBlockId()), RPropertyAttributes()); }else if (propertyTypeId == PropertyLayer) { if (humanReadable) { RDocument* document = getData().getDocument(); if (document != NULL) { RPropertyAttributes attr; if (!noAttributes) { // TODO: filter out locked layers: attr.setChoices(document->getLayerNames()); } return qMakePair(QVariant(document->getLayerName( getData().getLayerId())), attr); } } else { return qMakePair(QVariant(getData().getLayerId()), RPropertyAttributes()); } } else if (propertyTypeId == PropertyLinetype) { if (humanReadable) { RDocument* document = getData().getDocument(); if (document != NULL) { QVariant var; QSharedPointer<RLinetype> linetype = document->queryLinetype( getData().getLinetypeId()); var.setValue<RLinetype> (*linetype.data()); return qMakePair(var, RPropertyAttributes()); } } else { return qMakePair(QVariant(getData().getLinetypeId()), RPropertyAttributes()); } } else if (propertyTypeId == PropertyLineweight) { QVariant v; v.setValue<RLineweight::Lineweight>(getData().getLineweight()); return qMakePair(v, RPropertyAttributes()); } else if (propertyTypeId == PropertyColor) { QVariant var; var.setValue<RColor> (getData().getColor()); return qMakePair(var, RPropertyAttributes()); } else if (propertyTypeId == PropertyDrawOrder) { return qMakePair(QVariant(getData().getDrawOrder()), RPropertyAttributes()); } return RObject::getProperty(propertyTypeId, humanReadable, noAttributes); }
bool RGraphicsView::zoomToSelection() { RDocument* document = getDocument(); if (document == NULL) { return false; } RBox selectionBox = document->getSelectionBox(); if (selectionBox.isValid() && (selectionBox.getWidth()>RS::PointTolerance || selectionBox.getHeight()>RS::PointTolerance)) { zoomTo(selectionBox, getMargin()); return true; } return false; }
void RExporter::setLinetypeId(RLinetype::Id ltId) { RDocument* doc = NULL; if (getEntity()!=NULL) { doc = getEntity()->getDocument(); } if (doc == NULL) { doc = document; } currentLinetypePattern = RLinetypePatternMap::getPattern(doc->getLinetypeName(ltId)); }
RTransaction RDeleteAllEntitiesOperation::apply(RDocument& document, bool preview) const { RTransaction transaction(document.getStorage(), "Deleting object(s)", undoable); QSet<RObject::Id> ids = document.queryAllEntities(); QSetIterator<RObject::Id> i(ids); while (i.hasNext()) { transaction.deleteObject(i.next(), &document); } transaction.end(); return transaction; }
RTransaction RDeleteSelectionOperation::apply(RDocument& document, bool preview) const { RTransaction transaction(document.getStorage(), text); transaction.setGroup(transactionGroup); QSet<REntity::Id> selectedEntities = document.querySelectedEntities(); QSet<REntity::Id>::iterator it; for (it=selectedEntities.begin(); it!=selectedEntities.end(); it++) { transaction.deleteObject(*it); } transaction.end(); return transaction; }
QSharedPointer<RBlock> RClipboardOperation::copyBlock( RBlock::Id blockId, RDocument& src, RDocument& dest, bool overwriteBlocks, bool toCurrentBlock, const QString& blockName, RTransaction& transaction) const { QSharedPointer<RBlock> srcBlock = src.queryBlock(blockId); if (srcBlock.isNull()) { qWarning("RClipboardOperation::copyEntityBlock: " "block of entity is NULL."); return QSharedPointer<RBlock>(); } QString srcBlockName = srcBlock->getName(); QSharedPointer<RBlock> destBlock; if (copiedBlocks.contains(srcBlockName)) { destBlock = copiedBlocks.value(srcBlockName); } else { QString destBlockName; if (!blockName.isNull()) { destBlockName = blockName; } else { if (toCurrentBlock) { destBlockName = dest.getBlockName(dest.getCurrentBlockId()); } else { destBlockName = srcBlock->getName(); } } if (!dest.hasBlock(destBlockName) || (overwriteBlocks && blockName.isNull())) { destBlock = QSharedPointer<RBlock> (srcBlock->clone()); dest.getStorage().setObjectId(*destBlock.data(), RObject::INVALID_ID); dest.getStorage().setObjectHandle(*destBlock.data(), RObject::INVALID_HANDLE); destBlock->setDocument(&dest); if (dest.hasBlock(destBlockName)) { if (!transaction.overwriteBlock(destBlock)) { destBlock = dest.queryBlock(destBlockName); } } else { transaction.addObject(destBlock); } } else { destBlock = dest.queryBlock(destBlockName); } copiedBlocks.insert(srcBlockName, destBlock); } return destBlock; }
void RGraphicsView::setGridVisible(bool on) { gridVisible = (int)on; if (viewportNumber==-1) { return; } RDocument* doc = getDocument(); if (doc==NULL) { return; } doc->setVariable(QString("Grid/DisplayGrid0%1").arg(viewportNumber), on); }
QPair<QVariant, RPropertyAttributes> RBlockReferenceEntity::getProperty( RPropertyTypeId propertyTypeId, bool humanReadable, bool noAttributes) { if (propertyTypeId == PropertyType) { return qMakePair(QVariant(RS::EntityBlockRef), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyPositionX) { return qMakePair(QVariant(data.position.x), RPropertyAttributes()); } else if (propertyTypeId == PropertyPositionY) { return qMakePair(QVariant(data.position.y), RPropertyAttributes()); } else if (propertyTypeId == PropertyPositionZ) { return qMakePair(QVariant(data.position.z), RPropertyAttributes()); } else if (propertyTypeId == PropertyScaleX) { return qMakePair(QVariant(data.scaleFactors.x), RPropertyAttributes()); } else if (propertyTypeId == PropertyScaleY) { return qMakePair(QVariant(data.scaleFactors.y), RPropertyAttributes()); } else if (propertyTypeId == PropertyScaleZ) { return qMakePair(QVariant(data.scaleFactors.z), RPropertyAttributes()); } else if (propertyTypeId == PropertyRotation) { return qMakePair(QVariant(data.rotation), RPropertyAttributes(RPropertyAttributes::Angle)); } else if (propertyTypeId == PropertyReferencedBlock) { if (humanReadable) { RDocument* document = getData().getDocument(); if (document != NULL) { RPropertyAttributes attr; // TODO if (!noAttributes) { QSet<QString> blockNames = document->getBlockNames(); QSet<QString> filtered; QSet<QString>::iterator it; for (it=blockNames.begin(); it!=blockNames.end(); it++) { if (!(*it).startsWith("*")) { filtered.insert(*it); } } attr.setChoices(filtered); } return qMakePair(QVariant(document->getBlockName( getData().getReferencedBlockId())), attr); } } else { return qMakePair(QVariant(getData().getReferencedBlockId()), RPropertyAttributes()); } } return REntity::getProperty(propertyTypeId, humanReadable, noAttributes); }
QSharedPointer<RLayer> RClipboardOperation::copyLayer( RLayer::Id layerId, RDocument& src, RDocument& dest, bool overwriteLayers, RTransaction& transaction) const { bool overwriteLinetypes = false; // add layer the entity is on, if the layer exists it is overwritten // if overwriteLayers is true: QSharedPointer<RLayer> srcLayer = src.queryLayer(layerId); if (srcLayer.isNull()) { qWarning("RClipboardOperation::copyLayer: " "layer is NULL."); return QSharedPointer<RLayer>(); } QSharedPointer<RLinetype> destLinetype = copyLinetype(srcLayer->getLinetypeId(), src, dest, overwriteLinetypes, transaction); QString srcLayerName = srcLayer->getName(); QSharedPointer<RLayer> destLayer; if (copiedLayers.contains(srcLayerName)) { destLayer = copiedLayers.value(srcLayerName); Q_ASSERT(!destLayer.isNull()); } else { if (!dest.hasLayer(srcLayerName) || overwriteLayers) { destLayer = QSharedPointer<RLayer>(srcLayer->clone()); destLayer->setDocument(&dest); if (destLayer->getDocument()!=srcLayer->getDocument()) { dest.getStorage().setObjectId(*destLayer.data(), RObject::INVALID_ID); dest.getStorage().setObjectHandle(*destLayer.data(), RObject::INVALID_HANDLE); } transaction.addObject(destLayer); } else { destLayer = dest.queryLayer(srcLayerName); Q_ASSERT(!destLayer.isNull()); } copiedLayers.insert(srcLayerName, destLayer); } if (!destLinetype.isNull()) { destLayer->setLinetypeId(destLinetype->getId()); } return destLayer; }
void ROrthoGrid::setProjection(RS::IsoProjectionType p) { projection = (int)p; int viewportNumber = getViewportNumber(); if (viewportNumber==-1) { return; } RDocument* doc = getDocument(); if (doc==NULL) { return; } doc->setVariable(QString("Grid/IsometricProjection0%1").arg(viewportNumber), (int)p); }
void ROrthoGrid::setIsometric(bool on) { isometric = (int)on; int viewportNumber = getViewportNumber(); if (viewportNumber==-1) { return; } RDocument* doc = getDocument(); if (doc==NULL) { return; } doc->setVariable(QString("Grid/IsometricGrid0%1").arg(viewportNumber), on); }
RS::IsoProjectionType ROrthoGrid::getProjection() const { if (projection==-1) { int viewportNumber = getViewportNumber(); if (viewportNumber==-1) { return RS::IsoTop; } RDocument* doc = getDocument(); if (doc==NULL) { return RS::IsoTop; } projection = (int)doc->getVariable(QString("Grid/IsometricProjection0%1").arg(viewportNumber), (int)RS::IsoTop, true).toInt(); } return (RS::IsoProjectionType)projection; }
RTransaction RDeleteAllEntitiesOperation::apply(RDocument& document, bool preview) const { Q_UNUSED(preview) RTransaction transaction(document.getStorage(), text, undoable); transaction.setGroup(transactionGroup); QSet<RObject::Id> ids = document.queryAllEntities(); QSetIterator<RObject::Id> i(ids); while (i.hasNext()) { transaction.deleteObject(i.next()); } transaction.end(); return transaction; }
bool ROrthoGrid::isIsometric() const { if (isometric==-1) { int viewportNumber = getViewportNumber(); if (viewportNumber==-1) { return false; } RDocument* doc = getDocument(); if (doc==NULL) { return false; } isometric = (int)doc->getVariable(QString("Grid/IsometricGrid0%1").arg(viewportNumber), false, true).toBool(); } return isometric; }
bool RGrid::isVisible() const { if (visible==-1) { int viewportNumber = getViewportNumber(); if (viewportNumber==-1) { return true; } RDocument* doc = getDocument(); if (doc==NULL) { return true; } visible = (int)doc->getVariable(QString("Grid/DisplayGrid0%1").arg(viewportNumber), true, true).toBool(); } return visible; }
void RExporter::setLinetypeId(RLinetype::Id ltId) { RDocument* doc = NULL; if (getEntity()!=NULL) { doc = getEntity()->getDocument(); } if (doc == NULL) { doc = document; } QSharedPointer<RLinetype> lt = doc->queryLinetype(ltId); if (!lt.isNull()) { currentLinetypePattern = lt->getPattern(); } }
QPair<QVariant, RPropertyAttributes> RLeaderEntity::getProperty( RPropertyTypeId& propertyTypeId, bool humanReadable, bool noAttributes) { if (propertyTypeId == PropertyArrowHead) { return qMakePair(QVariant(data.arrowHead), RPropertyAttributes()); } else if (propertyTypeId == PropertyDimLeaderBlock) { if (humanReadable) { RDocument* document = getData().getDocument(); if (document != NULL) { RPropertyAttributes attr; if (!noAttributes) { QSet<QString> blockNames = document->getBlockNames(); QSet<QString> filtered; QSet<QString>::iterator it; for (it=blockNames.begin(); it!=blockNames.end(); it++) { if (!(*it).startsWith("*")) { filtered.insert(*it); } } attr.setChoices(filtered); } return qMakePair(QVariant(document->getBlockName( getData().getDimLeaderBlockId())), attr); } } else { return qMakePair(QVariant(getData().getDimLeaderBlockId()), RPropertyAttributes()); } } else if (propertyTypeId == PropertyVertexNX) { QVariant v; v.setValue(RVector::getXList(data.vertices)); return qMakePair(v, RPropertyAttributes(RPropertyAttributes::List)); } else if (propertyTypeId == PropertyVertexNY) { QVariant v; v.setValue(RVector::getYList(data.vertices)); return qMakePair(v, RPropertyAttributes(RPropertyAttributes::List)); } else if (propertyTypeId == PropertyVertexNZ) { QVariant v; v.setValue(RVector::getZList(data.vertices)); return qMakePair(v, RPropertyAttributes(RPropertyAttributes::List)); } return REntity::getProperty(propertyTypeId, humanReadable, noAttributes); }
RTransaction RCopyOperation::apply(RDocument& document, bool preview) const { RTransaction transaction(document.getStorage(), text); transaction.setGroup(transactionGroup); copy( src, document, offset, 1.0, 0.0, // scale, angle false, // flipHorizontal false, // flipVertical false, // toCurrentLayer false, // toCurrentBlock true, // overwriteLayers false, // overwriteBlocks QString(), // blockName QString(), // layerName transaction, true, // selectionOnly clear, // clear true, // toModelSpace (clipboard root is always model space) preview ); transaction.end(); return transaction; }
RTransaction RMixedOperation::apply(RDocument& document, bool preview) const { Q_UNUSED(preview) RTransaction transaction(document.getStorage(), text, undoable); transaction.setGroup(transactionGroup); for (int i = 0; i < list.size(); ++i) { if (list[i].first.isNull()) { qWarning() << "RMixedOperation::apply: " "list contains NULL object"; continue; } if (getMode(list[i].second, RMixedOperation::EndCycle)) { transaction.endCycle(); } else if (getMode(list[i].second, RMixedOperation::Delete)) { transaction.deleteObject(list[i].first); } else { transaction.addObject(list[i].first, getMode(list[i].second, RMixedOperation::UseCurrentAttributes), getMode(list[i].second, RMixedOperation::ForceNew)); } } transaction.end(); return transaction; }
RTransaction RAddObjectsOperation::apply(RDocument& document, bool preview) const { RTransaction transaction(document.getStorage(), "Adding object(s)", undoable); transaction.setRecordAffectedObjects(recordAffectedObjects); transaction.setSpatialIndexDisabled(spatialIndexDisabled); for (int i = 0; i < addedObjects.size(); ++i) { if (limitPreview && preview && i>RSettings::getPreviewEntities()) { break; } if (addedObjects[i].object.isNull()) { transaction.endCycle(); //qWarning() << "RAddObjectsOperation::apply: " // "list contains NULL object"; continue; } if (addedObjects[i].deleteIt) { transaction.deleteObject(addedObjects[i].object, &document); continue; } transaction.addObject( addedObjects[i].object, addedObjects[i].useCurrentAttributes, addedObjects[i].forceNew); } transaction.end(); return transaction; }