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); }
QPair<QVariant, RPropertyAttributes> REntity::getProperty( RPropertyTypeId& propertyTypeId, bool humanReadable, bool noAttributes) { if (propertyTypeId == PropertyType) { return qMakePair(QVariant(getType()), 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) { RPropertyAttributes attr; // if (!noAttributes) { // attr.setChoices(document->getLinetypeNames()); // } QString desc = document->getLinetypeLabel(getData().getLinetypeId()); return qMakePair(QVariant(desc), attr); } } else { return qMakePair(QVariant(getData().getLinetypeId()), RPropertyAttributes()); } } else if (propertyTypeId == PropertyLinetypeScale) { return qMakePair(QVariant(getData().getLinetypeScale()), 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 == PropertyDisplayedColor) { QVariant var; QStack<REntity*> stack; var.setValue<RColor> (getData().getColor(true, stack)); return qMakePair(var, RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyDrawOrder) { return qMakePair(QVariant(getData().getDrawOrder()), RPropertyAttributes()); } else if (propertyTypeId == PropertyMinX) { return qMakePair(QVariant(getBoundingBox().getMinimum().x), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyMinY) { return qMakePair(QVariant(getBoundingBox().getMinimum().y), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyMaxX) { return qMakePair(QVariant(getBoundingBox().getMaximum().x), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyMaxY) { return qMakePair(QVariant(getBoundingBox().getMaximum().y), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertySizeX) { return qMakePair(QVariant(getBoundingBox().getWidth()), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertySizeY) { return qMakePair(QVariant(getBoundingBox().getHeight()), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } return RObject::getProperty(propertyTypeId, humanReadable, noAttributes); }