本文整理汇总了C++中Ptr::ClearChanges方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::ClearChanges方法的具体用法?C++ Ptr::ClearChanges怎么用?C++ Ptr::ClearChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ptr
的用法示例。
在下文中一共展示了Ptr::ClearChanges方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMapLegendImage
//////////////////////////////////////////////////////////////////
// processes a GetMapLegendImage request from the Viewer and returns
// an image of the specified maps legend.
//
MgByteReader* MgHtmlController::GetMapLegendImage(CREFSTRING mapName,
CREFSTRING format, MgColor* backgroundColor, INT32 width,
INT32 height)
{
// Create a Resource Service instance
Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);
// Create MgMap
Ptr<MgMap> map = new MgMap();
map->Open(resourceService, mapName);
// Make sure we clear any track changes - these are not applicable for AJAX.
Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
if (changeLists->GetCount() > 0)
{
map->ClearChanges();
map->Save(resourceService);
}
// Create Proxy Rendering Service instance
Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
// Call the C++ API
return service->RenderMapLegend(map, width, height, backgroundColor, format);
}
示例2: GetDynamicMapOverlayImage_ViewCommands
//////////////////////////////////////////////////////////////////
// Processes a GetDynamicMapOverlayImage request from the Viewer and returns an image of the specified map.
//
MgByteReader* c_RestFetchImage::GetDynamicMapOverlayImage_ViewCommands(c_RestMgSiteConnection* MgSiteConn,CREFSTRING mapName, CREFSTRING format, bool bKeepSelection,MgPropertyCollection* mapViewCommands)
{
// Create a Resource Service instance
Ptr<MgResourceService> resourceService = (MgResourceService*)MgSiteConn->CreateService(MgServiceType::ResourceService);
// Create MgMap
Ptr<MgMap> map = new MgMap();
map->Open(resourceService, mapName);
// Apply map view commands
ApplyMapViewCommands(map, mapViewCommands);
// Make sure we clear any track changes - these are not applicable for AJAX.
Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
if (changeLists->GetCount() > 0)
{
map->ClearChanges();
map->Save(resourceService);
}
// Get the selection
Ptr<MgSelection> selection = new MgSelection(map);
selection->Open(resourceService, mapName);
// Create Proxy Rendering Service instance
Ptr<MgRenderingService> service = (MgRenderingService*)(MgSiteConn->CreateService(MgServiceType::RenderingService));
// Call the C++ API
return service->RenderDynamicOverlay(map, selection, format, bKeepSelection);
}//end of c_RestFetchImage::GetDynamicMapOverlayImage_ViewCommands
示例3: GetDynamicMapOverlayImage
//////////////////////////////////////////////////////////////////
// Processes a GetDynamicMapOverlayImage request from the Viewer and returns an image of the specified map.
//
MgByteReader* MgHtmlController::GetDynamicMapOverlayImage(CREFSTRING mapName, MgRenderingOptions* options, MgPropertyCollection* mapViewCommands)
{
// Create a Resource Service instance
Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);
// Create MgMap
Ptr<MgMap> map = new MgMap();
map->Open(resourceService, mapName);
// Make sure we clear any track changes - these are not applicable for AJAX.
Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
if (changeLists->GetCount() > 0)
{
map->ClearChanges();
map->Save(resourceService);
}
// Get the selection
Ptr<MgSelection> selection = new MgSelection(map);
selection->Open(resourceService, mapName);
// Apply map view commands
ApplyMapViewCommands(map, mapViewCommands);
// Make sure we clear any track changes - these are not applicable for AJAX.
map->ClearChanges();
// Save the MgMap state
map->Save(resourceService);
// Create Proxy Rendering Service instance
Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
// Call the C++ API
return service->RenderDynamicOverlay(map, selection, options);
}
示例4: QueryMapFeatures
//////////////////////////////////////////////////////////////////
// Processes a QueryMapFeatures request from the Viewer
//
MgByteReader* MgHtmlController::QueryMapFeatures(
CREFSTRING mapName,
MgStringCollection* layerNames,
MgGeometry* selectionGeometry,
INT32 selectionVariant,
CREFSTRING featureFilter,
INT32 maxFeatures,
bool persist,
INT32 layerAttributeFilter)
{
// Create a Resource Service instance
Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);
// Create MgMap
Ptr<MgMap> map = new MgMap();
map->Open(resourceService, mapName);
// Make sure we clear any track changes - these are not applicable for AJAX.
Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
if (changeLists->GetCount() > 0)
{
map->ClearChanges();
map->Save(resourceService);
}
// Create Proxy Rendering Service instance
Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
// Call the C++ API
Ptr<MgFeatureInformation> featureInfo = service->QueryFeatures(map, layerNames, selectionGeometry,
selectionVariant, featureFilter, maxFeatures, layerAttributeFilter);
if(persist)
{
//save the selection set in the session repository
Ptr<MgSelection> selection = featureInfo->GetSelection();
if(!selection)
selection = new MgSelection(map);
selection->Save(resourceService, mapName);
}
// Return XML
return featureInfo->ToXml();
}
示例5: GetVisibleMapExtent
//////////////////////////////////////////////////////////////////
// Processes a GetVisibleMapExtent request from the Viewer and returns info on the specified map.
//
MgByteReader* MgHtmlController::GetVisibleMapExtent(CREFSTRING mapName,
MgPropertyCollection* mapViewCommands)
{
// Create a Resource Service instance
Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);
// Open the MgMap
Ptr<MgMap> map = new MgMap();
map->Open(resourceService, mapName);
// Apply map view commands
ApplyMapViewCommands(map, mapViewCommands);
// Make sure we clear any track changes - these are not applicable for AJAX.
map->ClearChanges();
// Save the MgMap state
map->Save(resourceService);
// Calculate mcs width and height
double metersPerUnit = map->GetMetersPerUnit();
double mapScale = map->GetViewScale();
double devW = map->GetDisplayWidth();
double devH = map->GetDisplayHeight();
double metersPerPixel = 0.0254 / map->GetDisplayDpi();
double mcsW = mapScale * devW * metersPerPixel / metersPerUnit;
double mcsH = mapScale * devH * metersPerPixel / metersPerUnit;
// Make an envelope
Ptr<MgPoint> center = map->GetViewCenter();
Ptr<MgCoordinate> coord = center->GetCoordinate();
Ptr<MgCoordinateXY> coord0 = new MgCoordinateXY(coord->GetX() - 0.5*mcsW, coord->GetY() - 0.5*mcsH);
Ptr<MgCoordinateXY> coord1 = new MgCoordinateXY(coord->GetX() + 0.5*mcsW, coord->GetY() + 0.5*mcsH);
Ptr<MgEnvelope> envelope = new MgEnvelope(coord0, coord1);
// Return XML
return envelope->ToXml();
}