IlvGraphic* ColorLineRenderer::makeGraphic(const IlvMapFeature& feature, const IlvMapInfo& targetMapInfo, IlvMapsError& status) const { const IlvMapGeometry* geometry = feature.getGeometry(); if (!geometry) { status = IlvMaps::IllegalArgument(); return 0; } if (geometry->getClassInfo() != IlvMapLineString::ClassInfo()) { status = IlvMaps::ClassError(); return 0; } const IlvMapLineString* lineStr = (const IlvMapLineString*) geometry; int segCount = lineStr->getSegmentCount(); if (segCount == 0) return 0; IlvMapGeneralPath* genPath = new IlvMapGeneralPath(getDisplay()); const IlvMapSegment *segment; IlvCoordinate c; IlvPoint p; segment = lineStr->getSegment(0); c = segment -> getStartPoint(); status = targetMapInfo.toViews(c, feature.getProjection(), p); genPath->moveTo(p); for (int i = 0; i < segCount ; i++) { c = segment -> getEndPoint(); status = targetMapInfo.toViews(c, feature.getProjection(), p); genPath->lineTo(p); } |
IlvInt colorIndex = 0; const IlvFeatureAttributeProperty* attributeList = feature.getAttributes(); const IlvFeatureAttribute* fa = attributeList->getAttribute(_attributeName); const IlvMapClassInfo* clsinfo = fa->getClassInfo(); if(clsinfo->isSubtypeOf(IlvIntegerAttribute::ClassInfo())) colorIndex = ((IlvIntegerAttribute*)fa)->getValue(); else if(clsinfo->isSubtypeOf(IlvDoubleAttribute::ClassInfo())) colorIndex = (IlvInt)((IlvDoubleAttribute*)fa)->getValue(); IlvColor* color = getDisplay()-> getColor((IlvUShort)_colorModel->getRed(colorIndex), (IlvUShort)_colorModel->getGreen(colorIndex), (IlvUShort)_colorModel->getBlue(colorIndex)); genPath->setForeground(color); return genPath; } |