コード例 #1
0
//////////////////////////////////////////////////////////////////
// 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
コード例 #2
0
ファイル: DwfController.cpp プロジェクト: asir6/Colt
//////////////////////////////////////////////////////////////////
// Processes a GetMapUpdate request from the Viewer and
// returns an EMapTransaction DWF containing updated
// content for the specified map
//
MgByteReader* MgDwfController::GetMapUpdate(CREFSTRING mapName, int seqNo,
    CREFSTRING dwfVersion, CREFSTRING eMapVersion, MgPropertyCollection* mapViewCommands)
{
    //get an instance of the resource service
    Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);

    //recall the state of this map from the session repository
    Ptr<MgMap> map = new MgMap();
    map->Open(resourceService, mapName);

    m_operation = update;

    //apply new commands
    ApplyMapViewCommands(map, mapViewCommands);

    Ptr<MgDwfVersion> dwfv = new MgDwfVersion(dwfVersion, eMapVersion);

    //get an instance of the mapping service and call the GetMapUpdate API
    Ptr<MgMappingService> mappingService = (MgMappingService*)GetService(MgServiceType::MappingService);
    MgByteReader* br = mappingService->GenerateMapUpdate(map, seqNo, dwfv);

    //save the MgMap state
    map->Save(resourceService);

    return br;
}
コード例 #3
0
ファイル: DwfController.cpp プロジェクト: asir6/Colt
MgByteReader* MgDwfController::GetPlot(MgMap* map, MgPlotSpecification* plotSpec, MgLayout* layout, CREFSTRING dwfVersion,
        CREFSTRING ePlotVersion, MgPropertyCollection* mapViewCommands)
{
    //apply new commands
    ApplyMapViewCommands(map, mapViewCommands);

    Ptr<MgDwfVersion> dwfv = new MgDwfVersion(dwfVersion, ePlotVersion);

    //get an instance of the mapping service and call the GetMapUpdate API
    Ptr<MgMappingService> mappingService = (MgMappingService*)GetService(MgServiceType::MappingService);
    MgByteReader* br = NULL;

    // the presence of the data extent determines which GeneratePlot API we use
    Ptr<MgProperty> val;
    if (mapViewCommands != NULL)
        val = mapViewCommands->FindItem(m_mapCmdSetDataExtent);

    if (val != NULL)
    {
        Ptr<MgEnvelope> extent = map->GetDataExtent();
        br = mappingService->GeneratePlot(map, extent, true, plotSpec, layout, dwfv);
    }
    else
    {
        Ptr<MgPoint> center = map->GetViewCenter();
        Ptr<MgCoordinate> coord = center? center->GetCoordinate(): NULL;
        double scale = map->GetViewScale();
        br = mappingService->GeneratePlot(map, coord, scale, plotSpec, layout, dwfv);
    }

    return br;
}
コード例 #4
0
ファイル: HtmlController.cpp プロジェクト: asir6/Colt
//////////////////////////////////////////////////////////////////
// Processes a GetMapImage request from the Viewer and returns an image of the specified map.
//
MgByteReader* MgHtmlController::GetMapImage(MgMap* map, MgSelection* selection,
    CREFSTRING format, MgPropertyCollection* mapViewCommands, bool bKeepSelection, bool bClip)
{
    // Apply map view commands
    ApplyMapViewCommands(map, mapViewCommands);

    // Make sure we clear any track changes - these are not applicable for AJAX.
    if (NULL != map)
        map->ClearChanges();

    // Get Proxy Rendering Service instance
    Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));

    // Call the C++ API
    return service->RenderMap(map, selection, format, bKeepSelection, bClip);
}
コード例 #5
0
ファイル: HtmlController.cpp プロジェクト: asir6/Colt
//////////////////////////////////////////////////////////////////
// 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();
}
コード例 #6
0
ファイル: HtmlController.cpp プロジェクト: asir6/Colt
//////////////////////////////////////////////////////////////////
// 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);
}
コード例 #7
0
ファイル: DwfController.cpp プロジェクト: asir6/Colt
//////////////////////////////////////////////////////////////////
// Processes a GetMap request from the Viewer and returns
// a DWF containing an EMap that fully describes the map
// but does not yet contain any layer graphics
//
MgByteReader* MgDwfController::GetMap(MgResourceIdentifier* mapDefinition,
    CREFSTRING dwfVersion, CREFSTRING eMapVersion, MgPropertyCollection* mapViewCommands)
{
    //create a session id to associate with this map
    STRING sessionId;
    Ptr<MgUserInformation> userInfo = m_siteConn->GetUserInfo();
    if (userInfo.p != NULL) sessionId = userInfo->GetMgSessionId();
    if (sessionId.empty())
    {
        Ptr<MgSite> site = m_siteConn->GetSite();
        sessionId = site->CreateSession();
        userInfo->SetMgSessionId(sessionId);
    }

    //get an instance of the resource service
    Ptr<MgResourceService> resourceService = (MgResourceService*)GetService(MgServiceType::ResourceService);

    //instantiate a map object and let it load itself from the map definition in the resource repository
    Ptr<MgMap> map = new MgMap();
    map->Create(resourceService, mapDefinition, mapDefinition->GetName());

    m_operation = get;

    //apply commands
    ApplyMapViewCommands(map, mapViewCommands);

    //save the map state in the session repository
    Ptr<MgResourceIdentifier> resId = new MgResourceIdentifier(L"Session:" + sessionId + L"//" + mapDefinition->GetName() + L"." + MgResourceType::Map);
    map->Save(resourceService.p, resId.p);

    Ptr<MgDwfVersion> dwfv = new MgDwfVersion(dwfVersion, eMapVersion);

    //get an instance of the mapping service and call the GetMap API
    Ptr<MgMappingService> mappingService = (MgMappingService*)GetService(MgServiceType::MappingService);
    return mappingService->GenerateMap(map, sessionId, m_mapAgentUri, dwfv);
}