PointSymbol* OgrFileImport::getSymbolForOgrSymbol(OGRStyleToolH tool, const QByteArray& style_string) { Q_ASSERT(OGR_ST_GetType(tool) == OGRSTCSymbol); auto raw_tool_key = OGR_ST_GetStyleString(tool); auto tool_key = QByteArray::fromRawData(raw_tool_key, qstrlen(raw_tool_key)); auto symbol = point_symbols.value(tool_key); if (symbol && symbol->getType() == Symbol::Point) return static_cast<PointSymbol*>(symbol); int is_null; auto color_string = OGR_ST_GetParamStr(tool, OGRSTSymbolColor, &is_null); if (is_null) return nullptr; auto point_symbol = static_cast<PointSymbol*>(default_point_symbol->duplicate()); auto color = makeColor(tool, color_string); if (color) point_symbol->setInnerColor(color); else point_symbol->setHidden(true); auto key = style_string; key.detach(); point_symbols.insert(key, point_symbol); if (key != tool_key) { tool_key.detach(); point_symbols.insert(tool_key, point_symbol); } map->addSymbol(point_symbol, map->getNumSymbols()); return point_symbol; }
void Ellipse::setProperty(QString &xml) { QDomDocument doc("xml"); if (!doc.setContent(xml, false)) return; QDomElement root = doc.documentElement(); if (root.tagName() != "property") return; QDomNode n = root.firstChild(); while (!n.isNull()) { QDomElement e = n.toElement(); QString tagName = e.tagName(); if (tagName == "border-width") setBorderWidth(e.text().toDouble()); if (tagName == "border-color") setBorderColor(Color(e.text())); if (tagName == "inner-color") setInnerColor(Color(e.text())); if (tagName == "show-background") setShowBackground(e.text().toInt()); if (tagName == "aspect-type") setAspectType((Ellipse::AspectType)e.text().toInt()); if (tagName == "line-style") setLineStyle((GraphLib::LineStyle)e.text().toInt()); if (tagName == "dash-length") setDashLength(e.text().toDouble()); n = n.nextSibling(); } }