case MarkupCommand::Refresh: break; case MarkupCommand::Close: $markupManager->CloseMarkup(); $refreshMap = true; break; case MarkupCommand::Upload: $markupManager->UploadMarkup(); $refreshMap = true; break; case MarkupCommand::Download: $markupManager->DownloadMarkup(); break; case MarkupCommand::DownloadDataFromLayer: //The opened markup layer is the one we want to download $markupManager->SetArgument("MARKUPLAYER", $args["OPENMARKUP"]); $markupManager->DownloadMarkup(); break; case MarkupCommand::DownloadLayerKml: //The opened markup layer is the one we want to download $markupManager->SetArgument("MARKUPLAYER", $args["OPENMARKUP"]); $markupManager->DownloadMarkupAsKml(false); break; case MarkupCommand::DownloadLayerKmz: //The opened markup layer is the one we want to download $markupManager->SetArgument("MARKUPLAYER", $args["OPENMARKUP"]); $markupManager->DownloadMarkupAsKml(true); break; } } $availableMarkup = $markupManager->GetAvailableMarkup();
//Omission is considered false, which is the default. If you ever change //the default style values, uncomment the matching "true" values //$args["LABELBOLD"] = DefaultStyle::LABEL_BOLD; //$args["LABELITALIC"] = DefaultStyle::LABEL_ITALIC; //$args["LABELUNDERLINE"] = DefaultStyle::LABEL_UNDERLINE; $args["LABELFORECOLOR"] = DefaultStyle::LABEL_FORE_COLOR; $args["LABELBACKCOLOR"] = DefaultStyle::LABEL_BACK_COLOR; $args["LABELBACKSTYLE"] = DefaultStyle::LABEL_BACK_STYLE; $markupManager = new MarkupManager($args); $layerDef = $markupManager->CreateMarkup(); $resId = new MgResourceIdentifier($layerDef); $layerName = $resId->GetName(); $markupManager->SetArgument("MARKUPLAYER", $layerDef); $markupManager->OpenMarkup(); $responseJson = "{ success: true, refreshMap: true, layerDefinition: '$layerDef', layerName: '$layerName' }"; } catch (MgException $mge) { $errorMsg = $mge->GetExceptionMessage(); $errorDetail = $mge->GetDetails(); $stackTrace = $mge->GetStackTrace(); $responseJson = "{success: false, refreshMap: false, message:'$errorMsg\nDetail: $errorDetail\nStack Trace: $stackTrace'}"; } catch (Exception $e) { $errorMsg = $e->GetMessage(); $responseJson = "{success: false, refreshMap: false, message:'$errorMsg'}"; }