当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::AddFeatures方法代码示例

本文整理汇总了C++中Ptr::AddFeatures方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::AddFeatures方法的具体用法?C++ Ptr::AddFeatures怎么用?C++ Ptr::AddFeatures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ptr的用法示例。


在下文中一共展示了Ptr::AddFeatures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FetchImage

MgByteReader* c_RestFetchImage::FetchImage(c_RestUri* HttpRequest,c_CfgDataSource_MapGuide* MapGuideSource
                                  , const std::wstring& MapDefId,MgEnvelope* ZoomTo, const std::wstring& ZoomFactor
                                  , const std::wstring& MapSelectionLayer, const std::wstring& FeatureSource, const std::wstring& FdoClassName
                                  , MgFeatureQueryOptions *QueryOptions
                                  )
{
  
  
  Ptr<c_RestUriRequestParam> query_params = HttpRequest-> GetRequestParam();
  
  //Ptr<c_RestUriPathParam> path_params = HttpRequest-> GetUriPathParameters();
  //STRING filter = path_params->GetParameterValue(D_REST_URI_SEGMENT_MAP_IMAGE_PNG);  
  //Ptr<c_RestRequestParam> filterparams = new c_RestRequestParam();
  //RestUriFilterParser::Parse(filter, filterparams);
  
  Ptr<c_RestMgSiteConnection> mgsiteconn = c_RestMgSiteConnection::Open(MapGuideSource->GetUsername(),MapGuideSource->GetPassword(),MapGuideSource->GetServerIP(),MapGuideSource->GetServerPort());
  
  
  //MgHtmlController controller(mgsiteconn);
  
  // Get the map view commands
  //Ptr<c_RestRequestParam> params = m_hRequest->GetRequestParam();
  //Ptr<MgPropertyCollection> mapViewCommands = params->GetParameters()->GetPropertyCollection();
  //Ptr<MgPropertyCollection> mapViewCommands = filterparams->GetParameters()->GetPropertyCollection();
  
  
  STRING map_resid;
  STRING mapname;
  Ptr<MgMap> map;
  Ptr<MgSelection> selection;
  
  Ptr<MgPropertyCollection> mapviewcommands = new MgPropertyCollection();
  {
    STRING sessionid;
    Ptr<MgSite> mgSite = mgsiteconn->GetSite();
    sessionid = mgSite->CreateSession();
    
    
    //-------------------------------------------------------
    // Create a new Map from MapDefinition in a Session
    //-------------------------------------------------------  
      map = new MgMap();
      Ptr<MgResourceIdentifier> resid_mapdef = new MgResourceIdentifier(MapDefId);
      
     
      mapname = L"KINGREST";
   
      Ptr<MgResourceService> resourceService = dynamic_cast<MgResourceService*>(mgsiteconn->CreateService(MgServiceType::ResourceService));
         
      map->Create(resourceService, resid_mapdef, mapname );  
      // Save the MgMap state
      map_resid = L"Session:" + sessionid + L"//" + mapname + L"." + MgResourceType::Map;
      Ptr<MgResourceIdentifier> resid_map = new MgResourceIdentifier(map_resid);
      map->Save(resourceService,resid_map);
      
      
      selection = new MgSelection(map);
      if( MapSelectionLayer.length()>0 )
      {
        MgResourceIdentifier resId(FeatureSource);
        Ptr<MgFeatureService> service = (MgFeatureService*)(mgsiteconn->CreateService(MgServiceType::FeatureService));
        Ptr<MgFeatureReader> featureReader = service->SelectFeatures(&resId, FdoClassName, QueryOptions);
        
        //Ptr<MgResourceIdentifier> layerresidid = new MgResourceIdentifier(HttpRequest->m_DataLayerConfig->m_MapSelectionLayer);
        //Ptr<MgLayer> layerdef = new  MgLayer(layerid,resourceService);
        Ptr<MgLayerBase> layer;
        Ptr<MgLayerCollection> layers = map->GetLayers();
        
        
        int layerid =layers->IndexOf(MapSelectionLayer);
        if( layerid >= 0 )
        {
          layer = layers->GetItem(layerid);
        }
        //auto_ptr<MdfModel::LayerDefinition> layerdef( MgLayerBase::GetLayerDefinition(resourceService, layerid));         
        selection->AddFeatures(layer,featureReader,0);
        
        featureReader->Close();
      }
      selection->Save(resourceService, mapname);
      
      Ptr<MgReadOnlyLayerCollection> selLayers = selection->GetLayers();
      int sel_layercount = selLayers ? selLayers->GetCount() : 0;
      
      MgStringPropertyCollection* coll_params = query_params->GetParameters();
      
      int dwidth=260;
      int dheight=260;
      int dpi = 96;
      
      STRING strval;
      Ptr<MgStringProperty> prop;
      
      if( coll_params->Contains(L"SETDISPLAYWIDTH" ) )
      {
        
        
        STRING val = coll_params->GetValue(L"SETDISPLAYWIDTH");   
        dwidth = MgUtil::StringToDouble(val);     
        if( dwidth <= 0 ) dwidth=260;
//.........这里部分代码省略.........
开发者ID:Victorcasas,项目名称:georest,代码行数:101,代码来源:c_RestFetchImage.cpp


注:本文中的Ptr::AddFeatures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。