POST
|
I figured it out today. I finally noticed that when I manually set the graphic to the 10% crosshatch and then examined the symbol properties deeper, the symbol type was a Line Fill Symbol. On the other hand, the Add Graphic To Map snippet uses a Simple Fill Symbol. I had modified the snippet code to set the SimpleFillStyle to crosshatch (again, this displayed in ArcMap fine - the problem was that when exporting the map to a pdf or printing the map, the crosshatch pattern didn't come through and instead the polygon had a solid fill). I then found Create Line Fill Symbol snippet and changed the Add Graphic To Map snippet to use a LineFillSymbol instead a SimpleFillSymbol for my graphic. My original code created a graphic polygon with a crosshatch - the modified code creates a graphic polygon with a single diagonal line, but that's good enough to test if this fixes the problem, and IT DOES! Code is shown below . Public Sub AddGraphicToMap( ByVal map As ESRI.ArcGIS.Carto. IMap , ByVal geometry As ESRI.ArcGIS.Geometry. IGeometry , ByVal rgbColor As ESRI.ArcGIS.Display. IRgbColor , ByVal outlineRgbColor As ESRI.ArcGIS.Display. IRgbColor ) Dim graphicsContainer As ESRI.ArcGIS.Carto. IGraphicsContainer = CType (Map, ESRI.ArcGIS.Carto. IGraphicsContainer ) Dim element As ESRI.ArcGIS.Carto. IElement = Nothing If (geometry.GeometryType) = ESRI.ArcGIS.Geometry. esriGeometryType .esriGeometryPoint Then ' Marker symbols Dim simpleMarkerSymbol As ESRI.ArcGIS.Display. ISimpleMarkerSymbol = New ESRI.ArcGIS.Display. SimpleMarkerSymbolClass () simpleMarkerSymbol.Color = rgbColor simpleMarkerSymbol.Outline = True simpleMarkerSymbol.OutlineColor = outlineRgbColor simpleMarkerSymbol.Size = 15 simpleMarkerSymbol.Style = ESRI.ArcGIS.Display. esriSimpleMarkerStyle .esriSMSCircle Dim markerElement As ESRI.ArcGIS.Carto. IMarkerElement = New ESRI.ArcGIS.Carto. MarkerElementClass () markerElement.Symbol = simpleMarkerSymbol element = CType (markerElement, ESRI.ArcGIS.Carto. IElement ) ElseIf (geometry.GeometryType) = ESRI.ArcGIS.Geometry. esriGeometryType .esriGeometryPolyline Then ' Line elements Dim simpleLineSymbol As ESRI.ArcGIS.Display. ISimpleLineSymbol = New ESRI.ArcGIS.Display. SimpleLineSymbolClass () simpleLineSymbol.Color = rgbColor simpleLineSymbol.Style = ESRI.ArcGIS.Display. esriSimpleLineStyle .esriSLSSolid simpleLineSymbol.Width = 5 Dim lineElement As ESRI.ArcGIS.Carto. ILineElement = New ESRI.ArcGIS.Carto. LineElementClass () lineElement.Symbol = simpleLineSymbol element = CType (lineElement, ESRI.ArcGIS.Carto. IElement ) ElseIf (geometry.GeometryType) = ESRI.ArcGIS.Geometry. esriGeometryType .esriGeometryPolygon Then ''ORIGINAL AddGrahpicToMap code '' Polygon elements 'Dim simpleFillSymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass() 'simpleFillSymbol.Color = rgbColor 'simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSDiagonalCross 'Dim fillShapeElement As ESRI.ArcGIS.Carto.IFillShapeElement = New ESRI.ArcGIS.Carto.PolygonElementClass() 'fillShapeElement.Symbol = simpleFillSymbol 'element = CType(fillShapeElement, ESRI.ArcGIS.Carto.IElement) ''MODIFIED to use LineFillSymbol instead of SimpleFillSymbol ' Create the Line Symbol to be used Dim cartographicLineSymbol As ESRI.ArcGIS.Display. ICartographicLineSymbol = New ESRI.ArcGIS.Display. CartographicLineSymbolClass With cartographicLineSymbol .Cap = ESRI.ArcGIS.Display. esriLineCapStyle .esriLCSButt .Join = ESRI.ArcGIS.Display. esriLineJoinStyle. esriLJSMitre .Color = rgbColor .Width = 0.5 End With ' Create the LineFillSymbol Dim lineFillSymbol As ESRI.ArcGIS.Display. ILineFillSymbol = New ESRI.ArcGIS.Display. LineFillSymbolClass With lineFillSymbol .Angle = 45 .Separation = 10 .Offset = 5 End With lineFillSymbol.LineSymbol = cartographicLineSymbol Dim fillShapeElement As ESRI.ArcGIS.Carto. IFillShapeElement = New ESRI.ArcGIS.Carto. PolygonElementClass () fillShapeElement.Symbol = lineFillSymbol element = CType (fillShapeElement, ESRI.ArcGIS.Carto. IElement ) End If If Not (element Is Nothing ) Then element.Geometry = geometry graphicsContainer.AddElement(element, 0) End If End Sub
... View more
07-24-2014
02:13 PM
|
1
|
1
|
14
|
POST
|
I create a graphic on the map (not layout) using ArcObjects. It is a polygon with a gray cross-hatch fill. When I export the layout to pdf manually or through code, the graphic exports as a solid gray polygon. (I'm using the AddGraphicToMap snippet to create the graphic and the ExportActiveView sample to export to pdf). If I manually select the graphic on the map, go to its properties and set the symbol to the 10% Crosshatch symbol in the symbol selector and then export to pdf, the graphic exports correctly. I've found a few suggestions to do things like set the default printer page size to a larger size before exporting, but nothing I've found in my searches has had any effect on the ability to export this graphic correctly. Can anyone help me with this? Thanks.
... View more
07-22-2014
03:01 PM
|
0
|
2
|
3336
|
POST
|
I laughed out loud when I read your second paragraph! And I realized I included the wrong link above - this is the link to the PrintActiveView sample. http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Print_active_view/0001000002ms000000/ Have a great rest of your day.
... View more
07-17-2014
10:06 AM
|
0
|
0
|
24
|
POST
|
I'm using the ExportActiveView sample code to send a layout to a user-selected printer. The dataframe includes a cross-hatched graphic that is added by code. I have two issues: 1. When I print to the printer I have here, the graphic shows up on the printed paper. When my user at another office does the same with his printer, the graphic doesn't print at all. 2. On my printed copy (and a pdf-export from code as well), the graphic shows up as a gray rectangle when on the screen it appears as a cross-hatched rectangle with a tranparent background. If I manually print or export directly from ArcMap, the graphic has the right symbology. I've seen similar questions on these forums but finding them again is not the easiest thing to do these days...
... View more
07-17-2014
09:55 AM
|
0
|
2
|
2268
|
POST
|
Sorry - I was in a hurry when I wrote that and should have included more information. I see now that my question itself didn't say anything about coding. Since PrintAndExport is an ArcObjects CoClass name and I included that in the subject line, I thought it would be understood that it was a coding question. I'll be more aware of being more clear in the future. I should have included this in my earlier response as well - the line of code is from the ExportToActiveView ArcObjects sample found here: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000026000000
... View more
07-17-2014
08:46 AM
|
0
|
2
|
24
|
POST
|
No, I meant printing from code (isn't this an ArcObjects.Net discussion group?) I found the answer - I was making it much harder than it needed to be. All I had to do was this: paper.PrinterName = strPrinterName where strPrinterName is the name of the printer I want to print to, which may or may not be the default printer.
... View more
07-15-2014
02:29 PM
|
0
|
4
|
24
|
POST
|
I can find examples of printing to the default printing but am having a difficult navigating the new site to find an example of printing a map layout to a user-selected printer that is not the default printer. Can someone please help me with this? Thanks!
... View more
07-14-2014
07:05 AM
|
0
|
6
|
2201
|
POST
|
I've created a graphic polygon that is actually a polygon with the center cut out (I created it using ITopologicalOperator.Difference to remove the smaller polygon from the larger one). Now I want the labels on my map to display in the cutout area of my polygon. I found a suggestion to set IBarrierProps.Weight on my graphics layer and tried setting the weight to 0 hoping that the labels would then display but no luck. Any suggestions for me?
... View more
07-01-2014
10:33 AM
|
0
|
0
|
285
|
POST
|
Thanks Neil and Robby for your help. I marked Robby's response as the answer because it provided a little more information if someone else looks at this thread later (I had already created a polygon from the envelope, but it's probably good to note that in the answer.)
... View more
06-30-2014
05:54 AM
|
0
|
0
|
83
|
POST
|
I have two polygon geometries - one is a polygon from a feature and the other is created from the current view extent (which is always the larger polygon, if that matters). I want to subtract the feature polygon from the view extent polygon, creating a polygon with a donut hole in it. Is there a simple way to do this? I'm using VB.net. Thanks for any advice.
... View more
06-26-2014
01:52 PM
|
0
|
3
|
2949
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|