POST
|
i find my mistake: ...... display.FinishDrawing(); g.ReleaseHdc(); bmp.Save(@"c:\t.png", ImageFormat.Png);
... View more
01-03-2011
04:08 PM
|
0
|
0
|
194
|
POST
|
hi all: i want to draw some polyline in Bitmap using SimpleDisplay,but the bitmap is blank,what's wrong , thx! the code is: static void Main(string[] args) { //ESRI License Initializer generated code. m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeEngine }, new esriLicenseExtensionCode[] { }); //ESRI License Initializer generated code. //Do not make any call to ArcObjects after ShutDownApplication() System.Drawing.Point p1 = new System.Drawing.Point(20, 20); System.Drawing.Point p2 = new System.Drawing.Point(80, 80); IPolyline pc = new PolylineClass(); pc.FromPoint = ConvertToIPoint(p1); pc.ToPoint = ConvertToIPoint(p2); IDisplay display = new SimpleDisplayClass(); IDisplayTransformation tran = display.DisplayTransformation; Rectangle r = new Rectangle(0,0,100,100); IEnvelope env = (pc as IGeometry).Envelope; tran.Bounds = env; tran.VisibleBounds = env; tagRECT rect = new tagRECT(); rect.left = 0; rect.right = 100; rect.top = 0; rect.bottom = 100; tran.set_DeviceFrame(ref rect); Bitmap bmp = new Bitmap(100, 100); Graphics g = Graphics.FromImage(bmp); g.Clear(Color.White); display.StartDrawing(g.GetHdc().ToInt32(), (short)esriScreenCache.esriNoScreenCache); ISimpleLineSymbol s = new SimpleLineSymbol(); s.Style = esriSimpleLineStyle.esriSLSSolid; s.Width = 5; IRgbColor c = new RgbColorClass(); c.Red = 255; c.Blue = 0; c.Green = 0; s.Color = c; display.SetSymbol(s as ISymbol); display.DrawPolyline(pc as IPolyline); display.FinishDrawing(); bmp.Save(@"c:\t.png",ImageFormat.Png); g.ReleaseHdc(); m_AOLicenseInitializer.ShutdownApplication(); } public static IPoint ConvertToIPoint(System.Drawing.Point pt) { IPoint p = new PointClass(); IZAware z = p as IZAware; z.ZAware = true; IMAware m = p as IMAware; m.MAware = true; p.X = pt.X; p.Y = pt.Y; p.Z = 0; p.M = 0; p.SpatialReference = GetSpatialReference(); return p; } public static IEnvelope ConvertToEnvelope(Rectangle bound) { IEnvelope env = new EnvelopeClass(); IZAware z = env as IZAware; z.ZAware = true; IMAware m = env as IMAware; m.MAware = true; env.XMin = bound.Left; env.YMin = bound.Top; env.Width = bound.Width; env.Height = bound.Height; env.ZMin = 0; env.ZMax = 0; env.MMax = 0; env.MMin = 0; env.SpatialReference = GetSpatialReference(); return env; } public static ISpatialReference GetSpatialReference() { ISpatialReference spatial_ref = null; ISpatialReferenceFactory env = new SpatialReferenceEnvironmentClass(); //Beijing_1954_3_Degree_GK_CM_108E.prj(PCS) string prj_string = "PROJCS[\"Beijing_1954_3_Degree_GK_CM_108E\",GEOGCS[\"GCS_Beijing_1954\",DATUM[\"D_Beijing_1954\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",108.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"; int read_bytes; env.CreateESRISpatialReference(prj_string, out spatial_ref, out read_bytes); double len = 5000 * 1000; spatial_ref.SetFalseOriginAndUnits(-len, -len, 1000); spatial_ref.SetZFalseOriginAndUnits(-len, 1000); spatial_ref.SetMFalseOriginAndUnits(-len, 1000); return spatial_ref; }
... View more
12-28-2010
07:32 PM
|
0
|
2
|
300
|
POST
|
thank you very much ! follow your method, i add "WebRequest.RegisterPrefix("http://www.myserver.com/arcgis/rest", WebRequestCreator.ClientHttp); " before call the GP Service ,it's running correct, and i increase the points to 5000,also correct! FYI http://blogs.msdn.com/b/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx thank you very much again!
... View more
11-15-2010
02:52 PM
|
0
|
0
|
338
|
POST
|
hi all i find the problem is not how to pass the parameters. when i pass the parameters less than 9,all is correct,but when more than 9 wrong! and i find by using Fiddler when the parameters less than 9 ,the web method is "GET",but more than 9 the web method is "POST"?? and is there anywhere i can config or other?? thx!
... View more
11-14-2010
03:58 PM
|
0
|
0
|
338
|
POST
|
first thanks a lot. i use the Fiddler ,and the json information is: Stations={"geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100},"features":[{"geometry":{"x":13381735,"y":3702724,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"1"}},{"geometry":{"x":13372653,"y":3698329,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"2"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13376655,"y":3685459,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13383735,"y":3685039,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"3"}},{"geometry":{"x":13372207,"y":3699378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13371507,"y":3698318,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"6"}},{"geometry":{"x":13374367,"y":3694538,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13384887,"y":3703838,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"5"}},{"geometry":{"x":13383907,"y":3683678,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13382467,"y":3687998,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"4"}},{"geometry":{"x":13376607,"y":3690378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"7"}},{"geometry":{"x":13374229,"y":3696227,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"11"}},{"geometry":{"x":13370729,"y":3691187,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13375337,"y":3685363,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}}]}&f=json& ........ Especially ,in web application all is ok, i guess the parameters i pass to the GP is not correct, and in json information the {"FVALUE":"10"} is wrong, FVALUE should be integer type,here is string type??? can you show me a sample with how to pass the a lot of graphic with attribute to GP Service. thanks very much!
... View more
11-13-2010
01:02 AM
|
0
|
0
|
338
|
POST
|
hi all i build a GeoProcessing server in ModelBuilder: i use the IDW in Raster Interpolation to convert some point to raster,and then publish it to ArcGIS Server, in ArcGIS Desktop and Web Application ,call the GP it is ok, but in Silverlight C# , ERROR! the rest info is : Task: Model Display Name: Model Category: Help URL: http://demoserver/arcgisoutput/th/Model.htm Execution Type: esriExecutionTypeAsynchronous Parameters: Parameter: Stations Data Type: GPFeatureRecordSetLayer Display Name: Stations Direction: esriGPParameterDirectionInput Default Value: Geometry Type: esriGeometryPoint Spatial Reference: 102100 Fields: OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID) SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE) FVALUE (Type: esriFieldTypeInteger, Alias: FVALUE) Parameter Type: esriGPParameterTypeRequired Category: Parameter: Idw_1 Data Type: GPRasterDataLayer Display Name: Idw_1 Direction: esriGPParameterDirectionOutput Parameter Type: esriGPParameterTypeRequired Category: and the call code is : GraphicsLayer graphicsLayer = (GraphicsLayer)myMap.Layers["test"]; Random rand = new Random(); List<Graphic> lstItems = new List<Graphic>(); foreach (Graphic g in graphicsLayer.Graphics) { g.Attributes["FVALUE"] = rand.Next(1, 12); lstItems.Add(g); } FeatureSet fs = new FeatureSet(lstItems); fs.SpatialReference = new SpatialReference(102100); lstParms.Add(new GPFeatureRecordSetLayer("Stations", fs)); geoprocessorTask.SubmitJobAsync(lstParms); especially, i want pass some points with attribute,and then according these point's attribute call the GP to generator IDW Raster,but how to pass the parameter?? thx
... View more
11-11-2010
04:35 PM
|
0
|
7
|
786
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|