Exemplo n.º 1
0
void endElement(void *userData, const char *ename)
{
	if (!strcmp(ename, "node")) {
		struct tag *cur;
		int i;
		char *_id = escapeQuotes(id);
		char *_version = escapeQuotes(version);
		char *_timestamp = escapeQuotes(timestamp);
		char *_lat = escapeQuotes(lat);
		char *_lon = escapeQuotes(lon);

		if (isPOI()) {

			fprintf(stdout, "INSERT IGNORE INTO node (id, version, timestamp, lat, lon) VALUES ('%s', '%s', '%s', '%s', '%s');\n", _id, _version, _timestamp, _lat, _lon);
			for (cur = tag_list; cur; cur = cur->next) {
				char *_k = escapeQuotes(cur->key);
				char *_v = escapeQuotes(cur->value);
				fprintf(stdout, "INSERT IGNORE INTO tag (node_id, k, v) VALUES ('%s', '%s', '%s');\n", _id, _k, _v);
				FREE(_k);
				FREE(_v);
			}
			fflush(stdout);

		}

		parsing_node = 0;

		FREE(id);
		FREE(version);
		FREE(timestamp);
		FREE(lat);
		FREE(lon);

		FREE(_id);
		FREE(_version);
		FREE(_timestamp);
		FREE(_lat);
		FREE(_lon);

		if (tag_list) {
			tag *cur;
			tag *old;

			cur = tag_list;

			while (cur) {
				FREE(cur->key);
				FREE(cur->value);

				old = cur;
				cur = cur->next;
				free(old);
			}

			tag_list = NULL;
		}
	}
}
Exemplo n.º 2
0
bool Node::isSelectable(qreal PixelPerM, RendererOptions options)
{
    // If Node has non-default tags -> POI -> always selectable
    if (isPOI())
        return true;

    bool Draw = false;
    if (options.options.testFlag(RendererOptions::NodesVisible) || (lastUpdated() == Feature::Log && !options.options.testFlag(RendererOptions::TrackSegmentVisible))) {
        Draw = (PixelPerM * M_PREFS->getNodeSize() >= 1);
        // Do not draw GPX nodes when simple GPX track appearance is enabled
        if (M_PREFS->getSimpleGpxTrack() && layer()->isTrack())
            Draw = false;
        if (!Draw) {
            if (!sizeParents())
                Draw = true;
            else if (lastUpdated() == Feature::Log && !options.options.testFlag(RendererOptions::TrackSegmentVisible))
                Draw = true;
        }
    }
    return Draw;
}
Exemplo n.º 3
0
void Node::drawSimple(QPainter &P, MapView *theView)
{
//    if (!M_PREFS->getWireframeView() && !TEST_RFLAGS(RendererOptions::Interacting))
//        return;

    if (! ((isReadonly() || !isSelectable(theView->pixelPerM(), theView->renderOptions())) && (!isPOI() && !isWaypoint())))
        //        if (!Pt->isReadonly() && Pt->isSelectable(r))
    {
        if (!layer()) {
            qDebug() << "Node without layer: " << id().numId << xmlId();
            return;
        }
        qreal WW = theView->nodeWidth();
        if (WW >= 1) {
            QColor theColor = QColor(0,0,0,128);
            if (M_PREFS->getUseStyledWireframe() && hasPainter()) {
                const FeaturePainter* thePainter = getCurrentPainter();
                if (thePainter->DrawForeground)
                    theColor = thePainter->ForegroundColor;
                else if (thePainter->DrawBackground)
                    theColor = thePainter->BackgroundColor;
            }
            QPointF Pp(theView->toView(this));
            if (layer()->classGroups() & Layer::Special) {
                QRect R2(Pp.x()-(WW+4)/2, Pp.y()-(WW+4)/2, WW+4, WW+4);
                P.fillRect(R2,QColor(255,0,255,192));
            } else if (isWaypoint()) {
                QRect R2(Pp.x()-(WW+4)/2, Pp.y()-(WW+4)/2, WW+4, WW+4);
                P.fillRect(R2,QColor(255,0,0,192));
            }

            QRect R(Pp.x()-WW/2, Pp.y()-WW/2, WW, WW);
            P.fillRect(R,theColor);
        }
    }
}