/** * \param resolve True: resolve ByLayer / ByBlock and always return a * lineweight in 1/100 mm. * \param layer Layer to use for resolving if known, NULL otherwise. * \param blockRef Block reference to use for resolving if known, * NULL otherwise. */ RLineweight::Lineweight REntityData::getLineweight(bool resolve, const QStack<REntity*>& blockRefStack) const { if (!resolve) { return getLineweight(); } RLineweight::Lineweight lw = lineweight; if (lineweight==RLineweight::WeightByLayer) { const RDocument* doc = getDocument(); if (doc==NULL) { qWarning() << "REntityData::getLineweight: " "line weight is ByLayer but layer is NULL " "and document is NULL"; return RLineweight::Weight000; } QSharedPointer<RLayer> l = doc->queryLayerDirect(layerId); if (l.isNull()) { qWarning() << "REntityData::getLineweight: " "line weight is ByLayer but layer is invalid"; return RLineweight::Weight000; } lw = l->getLineweight(); if (lw==RLineweight::WeightByLayer) { qWarning() << "REntityData::getLineweight: " "line weight of layer '" << l->getName() << "' is ByLayer"; return RLineweight::Weight000; } if (RSettings::isLayer0CompatibilityOn()) { // entity in block on layer 0, use attributes of block reference if compatibility mode is on: if (l->getName()=="0") { if (!blockRefStack.isEmpty()) { lw = blockRefStack.top()->getLineweight(true, blockRefStack); } } } } else if (lineweight==RLineweight::WeightByBlock) { if (blockRefStack.isEmpty()) { return RLineweight::Weight000; } lw = blockRefStack.top()->getLineweight(true, blockRefStack); } if (lw==RLineweight::WeightByLwDefault) { // TODO: return default line weight: lw = RLineweight::Weight000; } if (lw==RLineweight::WeightInvalid) { // TODO: return default line weight: lw = RLineweight::Weight000; } if (lw<0) { qWarning() << "REntityData::getLineweight: not resolved: " << lw; } return lw; }
/** * Initializes the text data of the text label of this dimension. * The text data is created at 0/0 at an angle or 0. Moving the * label to the right position at the right angle is up to the * particular dimension implementation. */ void RDimensionData::initTextData() const { double dimtxt = getDimtxt(); QString label = getMeasurement(); // TODO: fontName property takes precedence textData = RTextData(RVector(0,0), // position RVector(0,0), // alignment point dimtxt, // text height 0.0, RS::VAlignMiddle, RS::HAlignCenter, RS::LeftToRight, RS::Exact, 1.0, label, //fontName, (document==NULL || document->getDimensionFont().isEmpty()) ? "Standard" : document->getDimensionFont(), false, false, 0.0, false // not simple (diameter signs, stacked text, ...) ); textData.setDocument(document); textData.setLayerId(getLayerId()); textData.setBlockId(getBlockId()); textData.setColor(getColor()); textData.setLineweight(getLineweight()); textData.setSelected(isSelected()); textData.setDimensionLabel(true); //qDebug() << "label color: " << textData.getColor(); //qDebug() << "textData: " << textData; dirty = true; }
/** * Stream operator for QDebug */ void REntity::print(QDebug dbg) const { dbg.nospace() << "REntity("; RObject::print(dbg); dbg.nospace() << ", type: " << getType() << ", layerId: " << getLayerId() << ", blockId: " << getBlockId() << ", lineweight: " << getLineweight() << ", linetypeId: " << getLinetypeId() << ", color: " << getColor() << ", drawOrder: " << getDrawOrder() << ", selectionStatus: " << isSelected() << ", boundingBoxes: " << getBoundingBoxes() << ")"; }
/** * Stream operator for QDebug */ void REntity::print(QDebug dbg) const { dbg.nospace() << "REntity("; RObject::print(dbg); dbg.nospace() << ", type: " << getType() << ", layerId: " << getLayerId() << ", blockId: " << getBlockId() << ", parentId: " << getParentId() << ", childIds: " << getDocument()->queryChildEntities(getId()) << ", lineweight: " << getLineweight() << ", linetypeId: " << getLinetypeId() << ", linetypeScale: " << getLinetypeScale() << ", color: " << getColor() << ", drawOrder: " << getDrawOrder() << ", selectionStatus: " << isSelected() << ", boundingBoxes: " << getBoundingBoxes() << ")"; }
// TODO: fix double REntityData::getLineweightInUnits(const QStack<RBlockReferenceEntity*>& blockRefStack) const { RLineweight::Lineweight lw = getLineweight(true, blockRefStack); // TODO: unit conversion: return lw / 100.0; }