Пример #1
0
bool MixtureCloud::urlSupported(const QUrl &url) const {
    return urlPattern().indexIn(url.toString()) == 0;
}
Пример #2
0
		Map*
		XmlBuilder::CreateMap (XMLNode& node, const Registry<JourneyPattern>& lines)
		{
			// assert ("map" == node.getName ());


			int outputWidth (GetIntAttr (node, "outputWidth", -1));
			int outputHeight (GetIntAttr (node, "outputHeight", -1));

			// Drawable lines
			std::set<DrawableLine*> selectedLines;
			int nbDrawableLines = node.nChildNode ("drawableLine");
			for (int i=0; i<nbDrawableLines; ++i)
			{
			XMLNode drawableLineNode = node.getChildNode ("drawableLine", i);
			selectedLines.insert (CreateDrawableLine (drawableLineNode, lines));
			}

			const MapBackgroundManager* mbm = 0;

			std::string backgroundId (GetStringAttr (node, "backgroundId", ""));
			if (backgroundId != "")
			{
			try
			{
				mbm = MapBackgroundManager::GetMapBackgroundManager (backgroundId);
			}
			catch (synthese::Exception& ex)
			{
				Log::GetInstance ().warn ("Cannot find background", ex);
			}
			}

			std::string urlPattern (GetStringAttr (node, "urlPattern", ""));

			Map* map = 0;

			bool preserveRatio (GetBoolAttr (node, "preserveRatio", true));

			double neighborhood (GetDoubleAttr (node, "neighborhood", 0.0));

			// If one of the 4 coordinates is missing, let the autofit
			// feature process the right rectangle
			if (
			(HasAttr (node, "lowerLeftLatitude") == false) ||
			(HasAttr (node, "lowerLeftLongitude") == false) ||
			(HasAttr (node, "upperRightLatitude") == false) ||
			(HasAttr (node, "upperRightLongitude") == false)
			)
			{
			map = new Map (selectedLines,
					outputWidth,
					outputHeight,
					neighborhood,
					preserveRatio,
					mbm, urlPattern);

			}
			else
			{
			double lowerLeftLatitude (GetDoubleAttr (node, "lowerLeftLatitude"));
			double lowerLeftLongitude (GetDoubleAttr (node, "lowerLeftLongitude"));
			double upperRightLatitude (GetDoubleAttr (node, "upperRightLatitude"));
			double upperRightLongitude (GetDoubleAttr (node, "upperRightLongitude"));

				map = new Map (selectedLines,
					Rectangle (lowerLeftLatitude,
						lowerLeftLongitude,
						upperRightLatitude - lowerLeftLatitude,
						upperRightLongitude - lowerLeftLongitude),
					outputWidth,
					outputHeight,
					preserveRatio,
					mbm, urlPattern);


			}


			bool lineGrouping (GetBoolAttr (node, "lineGrouping", true));
			if (lineGrouping) map->setLineGrouping (lineGrouping);

			return map;
		}