Select to view content in your preferred language

Java Print SOE error prevents maps with dawn graphics from printing

3919
9
Jump to solution
03-01-2013 09:58 AM
CarrieMunill
Emerging Contributor
Hi all,

I would like to use TomLUX's Advanced Print Solution but have run into a problem when trying to print with graphics drawn on the screen. I get the following error message when the graphic is a polygon:

ReferenceError: Error #1069: Property textFormat not found on lu.etat.pch.gis.widgets.pchPrintWidget.json.AgsJsonSimpleFillSymbol and there is no default value.  at lu.etat.pch.gis.widgets.pchPrintWidget::PchJSONUtils$/encodeGraphic()  at lu.etat.pch.gis.widgets.pchPrintWidget.utils::MapUtils$/getPrintLayers()  at lu.etat.pch.gis.widgets.pchPrintWidget::PchPrintWidget/calculateWebMapJson()  at lu.etat.pch.gis.widgets.pchPrintWidget::PchPrintWidget/btnPrint2_printSelectExtent()  at lu.etat.pch.gis.widgets.pchPrintWidget::PchPrintWidget/__btnPrint2_click()


Similarly I get errors when the graphics are lines:
...Property textFormat not found on lu.etat.pch.gis.widgets.pchPrintWidget.json.AgsJsonSimpleLineSymbol...

and point:
...Property textFormat not found on lu.etat.pch.gis.widgets.pchPrintWidget.json.AgsJsonSimpleMarkerSymbol...

But NOT if the graphic is text. This happens before the printSelectedExtent function is called, so I can't figure out where I can toggle a breakpoint in debug mode to figure it out. Can someone with experience with this widget help deduce where I can make the code change to prevent this from happening? I am using the uncompiled version of the widget in a 3.0 viewer.

Thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
TomSchuller
Frequent Contributor
Here the right code:
if("textFormat" in graObj.symbol) {  if("color" in graObj.symbol.textFormat) {   graObj.symbol.color = graObj.symbol.textFormat.color;   graObj.symbol.textFormat.color = null;   graObj.symbol.borderLineColor = null;  } }


Sorry for the delay.

Tom

View solution in original post

0 Kudos
9 Replies
TomSchuller
Frequent Contributor
Hy,
just make a breakpoint into the method "encodeGraphic" in the PchJsonUtils class.

Could you step through to the point where the code is failing?
I suppose somewhere in a "getFromObject" method.
Could you make a printscreen of the debugger view of the "symbol" object?

Tom
0 Kudos
CarrieMunill
Emerging Contributor
Hi Tom,

Thanks for the reply. I actually did that and it is in fact failing in the encodeGraphic function at the line

if(graObj.symbol.textFormat && graObj.symbol.textFormat.color) {


See attached for a screenshot. Stepping beyond this line results in the error message I first wrote about. Also attached is a screenshot of the graObj.symbol from the debugger - do I need to drill down further?

Thank you very much for your help,

Carrie
0 Kudos
TomSchuller
Frequent Contributor
Could you replace the "if" by this code:

if(graObj.symbol.textFormat) {
 if(graObj.symbol.textFormat.color) {
  graObj.symbol.color = graObj.symbol.textFormat.color;
  graObj.symbol.textFormat.color = null;
  graObj.symbol.borderLineColor = null;
 }
}


If the "symbol" has no "textFormat", it should not enter into.
Maybe you have to set correct the if to "if(graObj.symbol.textFormat !=null)" or similar.
Sorry, but I don't have a possibility to try the code.

Let me know which code is working, I will correct it.

Tom
0 Kudos
CarrieMunill
Emerging Contributor
Hi Tom,

Thanks for those suggestions. That's what I thought might be happening, but I didn't know how to change it to prevent it from happening. Unfortunately, it looks like both options

   if (graphic.symbol) {
    graObj.symbol = encodeSymbol(graphic.symbol);
    if(graObj.symbol.textFormat != null) {
     if(graObj.symbol.textFormat.color) {
      graObj.symbol.color = graObj.symbol.textFormat.color;
      graObj.symbol.textFormat.color = null;
      graObj.symbol.borderLineColor = null;
     }
    }


and

   if (graphic.symbol) {
    graObj.symbol = encodeSymbol(graphic.symbol);
    if(graObj.symbol.textFormat) {
     if(graObj.symbol.textFormat.color) {
      graObj.symbol.color = graObj.symbol.textFormat.color;
      graObj.symbol.textFormat.color = null;
      graObj.symbol.borderLineColor = null;
     }
    }


still allow the loop to be entered, at which point I still get the same error. Can you think of any other options? Perhaps my syntax is incorrect. I will also poke around and see if I can't find any additional information.

Edit: I do notice that when the DrawWidget swf loads, I get the following error:

warning: unable to bind to property 'style' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'style' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'style' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'style' on class 'Object' (class is not an IEventDispatcher)


This is using the default DrawWidget that comes with the viewer. Is this related?

Carrie
0 Kudos
TomSchuller
Frequent Contributor
Here the right code:
if("textFormat" in graObj.symbol) {  if("color" in graObj.symbol.textFormat) {   graObj.symbol.color = graObj.symbol.textFormat.color;   graObj.symbol.textFormat.color = null;   graObj.symbol.borderLineColor = null;  } }


Sorry for the delay.

Tom
0 Kudos
CarrieMunill
Emerging Contributor
Hi Tom,

That works great! I tried many things, but that was not one of them, or course.

Now, however, I am experiencing that the graphics alpha (transparency) is not being honored in the exported file... I know that the standard print widget allows you to give transparency to graphics (and they will print that way), and I thought yours did too now. I haven't looked too deeply into it yet, but I can tell that the alpha values that you set with the drawing tool (from 0 - 1) are being assigned to variables correctly. Any ideas? I thought I read another thread about this at some point, but I can't find it now...

Thanks so much for your assistance!
0 Kudos
TomSchuller
Frequent Contributor
Unfortanly, I didn't yet found a solution for transparent graphics support.
My code is rebuilding the entire 'printout' in ArcObjects (ArcMAP) and is making the printout in ArcObjects.
As ArcMap doesn't support transparent graphics, I can't realize it with the ArcObject code.

Just take the generated mxd file in the arcgisoutput-folder  and try to set it transparent in ArcMAP.
If you find a way, let me know and I will implement it.

The standard print in the FlexViewer is just making a printscreen of the flash image.

Tom
0 Kudos
CarrieMunill
Emerging Contributor
Hi Tom,

I hadn't thought of that. One thing I can think of: in ArcGIS for Desktop, if you have graphics on the map you can convert them to features (shapefile or featureclasses) using the Convert Graphics to Features command that is in the drawing menu. I don't think there is a toolbox tool to do it, but I have seen (older) code around on how to do it programmatically. Since the application has write access to a folder on the server machine (where the mxd, layers, and output are written) might it be possible to convert any graphics to temporary shapefiles to be ingested during the print process and have the transparency that is chosen be applied? I'm not sure how complicated file (and attribute) management would become in that case...

Carrie
0 Kudos
TomSchuller
Frequent Contributor
Hy,
this is a good direction/workaround for the tranparency problem.
Will try to find some time to implement it.

If you have any code, you could mail it to: tom @ schuller.lu

Tom
0 Kudos