-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] MapXtreme .Net

, 25 2017 . 13:21 +
! SDK MapXtreme .Net Pitney Bowes. :
MapInfo MapXtreme for .Net Microsoft .Net, -.


. MS VisualStudio 2015 ( MSVS2010 , ).

. 7.1 60 ( 8 , , MapXtreme. ).

, , ? MapXtreme ADC WorldMap Version 7.1.

, MapXtreme .Net.


, , MapXtreme . SDK
MapXtreme Developers Reference
MapXtreme Version 8.0 Developer Guide

, . . . - ..

, :

image

3-4 , :

, ..

, . .


, VisualStudio MapXtreme ( 8.0, .. ).

image

Windows Form App. ToolBox
Tools -> Choose ToolBox Items...

:

image

, , MapXtreme . MapXteme ToolStrip, .

image

MapControl MapControl. mapControl1, .

private void Form1_Load(object sender, EventArgs e)
{
    addrectangleToolStripButton1.MapControl = mapControl1;
    ....
}

, :

image

, , ! ?

. mapControl .

MapXtreme Layer Control .

image

:

var layerTemp = mapControl1.Map.Layers["wldcty25"];            
LayerHelper.SetInsertable(layerTemp, true);//     
LayerHelper.SetEditable(layerTemp, true);  //   

, , wldcty25 :

image

:

mapControl1.Map.Layers.Move(lastPosition, nextPosition);

:

image

. , / MapXtreme. .

. CompositeStyle. MapXtreme . , .

SimpleLineStyle border;//  
border= new SimpleLineStyle(<    MapXtreme>, <  >,  < >)
SimpleInterior interior;//   
interior = new SimpleInterior(< >, <  >,< >)
AreaStyle polygon;//         
polygon = new AreaStyle(border, interior);

SimpleLineStyle line;//  
line = new SimpleLineStyle(<    MapXtreme>, <  >, < >)

BasePointStyle point;//  
point = new SimpleVectorPointStyle(< >, < >, < >)

CompositeStyle compStyle;//   
compStyle = CompositeStyle(polygon, line, null, point);

:

FeatureOverrideStyleModifier fosm;
fosm = new FeatureOverrideStyleModifier(parStyleName, parStyleAlias, compStyle);
myLayer.Modifiers.Append(featureOverrideStyleModifier);

:

Feature feature = null;
feature = new Feature(<   >, compStyle);


:

//   
DPoint[] pts1 = new DPoint[5];
pts1[0] = new DPoint(-20, 10);//     
pts1[1] = new DPoint(10, 15);
pts1[2] = new DPoint(15, -10);
pts1[3] = new DPoint(-10, -10);
pts1[4] = new DPoint(-20, 10);
//   
DPoint[] pts2 = new DPoint[5];
pts2[0] = new DPoint(-40, 50);
pts2[1] = new DPoint(60, 45);
pts2[2] = new DPoint(65, -40);
pts2[3] = new DPoint(25, 20);
pts2[4] = new DPoint(-40, 50);
//LineString     DPoint
LineString lineString1 = new LineString(coordSys, pts1);
LineString lineString2 = new LineString(coordSys, pts2);

:



//Ring     coordSys   LineString 
Ring ring1 = new Ring(coordSys, lineString1);
Ring ring2 = new Ring(coordSys, lineString2);
Ring[] rng1 = new Ring[2];
rng1[0] = ring2;
rng1[1] = ring1;
//MultiPolygon    Ring
MultiPolygon multiPol = new MultiPolygon(coordSys, rng1);



//Curve     coordSys   LineString 
Curve curve4 = new Curve(coordSys, lineString1);
Curve curve5 = new Curve(coordSys, lineString2);
Curve[] crv = new Curve[2];
crv[0] = curve5;
crv[1] = curve4;
//MultiCurve    Curve 
MultiCurve mc = new MultiCurve(coordSys, crv);


:

CoordSys oordSys= mapControl1.Map.GetDisplayCoordSys();

:

CoordSys cs = Session.Current.CoordSysFactory.CreateCoordSys("EPSG:3395", CodeSpace.Epsg); 
mapControl1.Map.SetDisplayCoordSys(cs);

, - .

. . , . :

mapControl1.Map.RasterReprojectionMethod = ReprojectionMethod.Always;    
/**
*ReprojectionMethod   
*        None = 0, //   
*        Always = 1,// 
*        Optimized = 2//     ,         
*        
*/

GeoTiff. MapXtreme . *.tab , , , .

*.tab MapXtreme , , :

private string CreateTabFile(List parImageCoordinate)//  
{
    NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
    var ext = m_fileName.Split(new Char[] { '.' });
    var fileExt = ext[ext.GetLength(0) - 1];
    string fileTabName = m_fileName.Substring(0, m_fileName.Length - fileExt.Length) + "TAB";
    StreamWriter sw = new StreamWriter(fileTabName);
    string header = "!table\n!version 300\n!charset WindowsCyrillic\n \n";
    sw.WriteLine(header);

    string definitionTables = "Definition Table\n  ";
    definitionTables += "File \"" + m_fileName + "\"\n  ";
    definitionTables += "Type \"RASTER\"\n  ";
    for (var i = 0; i < parImageCoordinate.Count; i++)
    {
        definitionTables += "(" + parImageCoordinate[i].Longitude.ToString("N", nfi) + "," + parImageCoordinate[i].Latitude.ToString("N", nfi) + ") ";
        definitionTables += "(" + parImageCoordinate[i].PixelColumn.ToString() + "," + parImageCoordinate[i].PixelRow.ToString() + ") ";
        definitionTables += "Label \" " + (i + 1).ToString() + " \",\n  ";
     }
     definitionTables = definitionTables.Substring(0, definitionTables.Length - 4);
     definitionTables += "\n  ";
     definitionTables += "CoordSys Earth Projection 1, 104\n  ";
     definitionTables += "Units \"degree\"\n";
     sw.WriteLine(definitionTables);
            
     string metaData = "begin_metadata\n";
     metaData += "\"\\IsReadOnly\" = \"FALSE\"\n";
     metaData += "\"\\MapInfo\" = \"\"\n";

     string hash;
     using (MD5 md5Hash = MD5.Create())
     {
         hash = GetMd5Hash(md5Hash, m_fileName);
     }

      metaData += "\"\\MapInfo\\TableID\" = \"" + hash + "\"\n";
      metaData += "end_metadata\n";
      sw.WriteLine(metaData);
      sw.Close();
      return fileTabName;
}

GetMd5Hash MSDN. , mapControl1 .

. , . ? , / .
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/331590/

:  

: [1] []
 

:
: 

: ( )

:

  URL