Пример #1
0
void
PCLoaderXML::myCharacters(int element,
                          const std::string& chars) {
    if (element == SUMO_TAG_POLY) {
        bool ok = true;
        PositionVector pshape = GeomConvHelper::parseShapeReporting(chars, "poly", myCurrentID.c_str(), ok, false);
        if (!ok) {
            return;
        }
        const PositionVector::ContType& cont = pshape.getCont();
        PositionVector shape;
        for (PositionVector::ContType::const_iterator i = cont.begin(); i != cont.end(); ++i) {
            Position pos((*i));
            if (!GeoConvHelper::getProcessing().x2cartesian(pos)) {
                WRITE_WARNING("Unable to project coordinates for polygon '" + myCurrentID + "'.");
            }
            shape.push_back(pos);
        }
        Polygon* poly = new Polygon(myCurrentID, myCurrentType, myCurrentColor, shape, false);
        if (!myCont.insert(myCurrentID, poly, myCurrentLayer, myCurrentIgnorePrunning)) {
            WRITE_ERROR("Polygon '" + myCurrentID + "' could not been added.");
            delete poly;
        }
    }
}