Mercurial > mxd2map
comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 317:5a2b5bc066eb
Implement Label Styles and Labels with background
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 20 Sep 2012 12:55:21 +0200 |
parents | 1d77ea6a915d |
children | 9289b7c1b4ce |
comparison
equal
deleted
inserted
replaced
316:5e3a40a84539 | 317:5a2b5bc066eb |
---|---|
406 layer.setTileitem(""); | 406 layer.setTileitem(""); |
407 } | 407 } |
408 else if(type.equals("raster")) { | 408 else if(type.equals("raster")) { |
409 layer.setType(MS_LAYER_TYPE.MS_LAYER_RASTER); | 409 layer.setType(MS_LAYER_TYPE.MS_LAYER_RASTER); |
410 } | 410 } |
411 else if (type == "annotation") { | |
412 layer.setType(MS_LAYER_TYPE.MS_LAYER_ANNOTATION); | |
413 } | |
411 | 414 |
412 //The layer datasource. | 415 //The layer datasource. |
413 String con_type = layerElement.getAttribute("connection_type"); | 416 String con_type = layerElement.getAttribute("connection_type"); |
414 if(con_type.equals("local")) { | 417 if(con_type.equals("local")) { |
415 // The data source is a local file. (.shp or Image) | 418 // The data source is a local file. (.shp or Image) |
546 // Set Offsite value for raster layer | 549 // Set Offsite value for raster layer |
547 if(type == "raster") { | 550 if(type == "raster") { |
548 layer.setOffsite(new colorObj(255,255,255,-4)); | 551 layer.setOffsite(new colorObj(255,255,255,-4)); |
549 } | 552 } |
550 | 553 |
554 // Set scaling properties for layer | |
555 if(type == "annotation") { | |
556 if (mapNode.hasAttribute("referencescale")) { | |
557 layer.setSymbolscaledenom(Double.parseDouble( | |
558 mapNode.getAttribute("referencescale"))); | |
559 } | |
560 } | |
561 | |
551 // Create labelitem | 562 // Create labelitem |
552 NodeList labels = layerElement.getElementsByTagName("label"); | 563 NodeList labels = layerElement.getElementsByTagName("label"); |
553 if(labels.getLength() > 0) { | 564 if(labels.getLength() > 0) { |
554 Element label = (Element)labels.item(0); | 565 Element label = (Element)labels.item(0); |
555 String expr = label.getAttribute("expression"); | 566 String expr = label.getAttribute("expression"); |
607 | 618 |
608 // Write the Style / Symbol once | 619 // Write the Style / Symbol once |
609 if ( i == 0 ) { | 620 if ( i == 0 ) { |
610 classObj co = new classObj(layer); | 621 classObj co = new classObj(layer); |
611 writeLabel(co, feature, layerElement.getAttribute("type")); | 622 writeLabel(co, feature, layerElement.getAttribute("type")); |
612 MarkerStyleWriter swriter = new MarkerStyleWriter (this.map, co); | 623 LabelStyleWriter swriter = new LabelStyleWriter (this.map, co); |
613 swriter.write((Element)feature.getFirstChild()); | 624 swriter.write((Element)feature.getFirstChild()); |
614 } | 625 } |
615 layer.addFeature(shape); | 626 layer.addFeature(shape); |
616 } | 627 } |
617 } | 628 } |
756 | 767 |
757 //Set the label position. | 768 //Set the label position. |
758 if(layerType.equals("point")) { | 769 if(layerType.equals("point")) { |
759 label.setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue()); | 770 label.setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue()); |
760 } | 771 } |
772 | |
773 //Set annotation specific values | |
774 if (layerType == "annotation") { | |
775 label.setPosition(MS_POSITIONS_ENUM.MS_CC.swigValue()); | |
776 label.setOffsetx(2); | |
777 label.setOffsety(-2); | |
778 } | |
779 | |
761 } | 780 } |
762 } | 781 } |
763 | 782 |
764 /** Sanitze an attribute | 783 /** Sanitze an attribute |
765 * | 784 * |