}
}
private void configureMap() {
try {
MapToolApp app = (MapToolApp) getParent();
MapDesc mapDesc = app.getMapDesc();
WkidItem wkidItem = (WkidItem) this.jComboBoxWkid.getSelectedItem();
mapDesc.setWkid(wkidItem.getWkid());
mapDesc.setName(this.jTextFieldName.getText());
mapDesc.setAntiAlias(this.jCheckBoxAntiAlias.isSelected());
Color bgColor = this.jColorChooserBgColor.getColor();
mapDesc.setBackgroundColor(bgColor);
double xmin = Double.parseDouble(jTextFieldXmin.getText()
.equals("") ? "0" : jTextFieldXmin.getText());
double xmax = Double.parseDouble(jTextFieldXmax.getText()
.equals("") ? "0" : jTextFieldXmax.getText());
double ymin = Double.parseDouble(jTextFieldYmin.getText()
.equals("") ? "0" : jTextFieldYmin.getText());
double ymax = Double.parseDouble(jTextFieldYmax.getText()
.equals("") ? "0" : jTextFieldYmax.getText());
Envelope initialExtent = new Envelope(xmin, xmax, ymin, ymax);
mapDesc.setInitialExtent(initialExtent);
mapDesc.getLayerInfos().clear();
for (int i = 0, count = this.jListLayersModel.getSize(); i < count; i++) {
LayerItem item = (LayerItem) this.jListLayersModel
.getElementAt(i);
LayerInfo layerInfo = item.getLayerInfo();
mapDesc.getLayerInfos().add(layerInfo);
}
app.getMap().initByMapDesc(mapDesc, app.getMapDescFilePath());
app.getMapPane().setBackground(bgColor);
MapContext mapContext = app.getMap().getMapContext();
if (mapContext != null) {
app.setMapContext(mapContext);
app.pack();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Configure Map Error!");
}
}