I believe I have found a solution, any feedback would be appreciated.
I made the following changes to the JMapPane.paintComponent() method:
- Calculate the component Z order of the map pane. I did this by hard
coding in the following lines but I will create a better solution after I
have completed more testing.
JRootPane rootPane = getRootPane();
JInternalFrame internalFrame = (JInternalFrame)rootPane.getParent();
JDesktopPane desktopPane = (JDesktopPane)internalFrame.getParent();
int componentZOrder = desktopPane.getComponentZOrder(internalFrame);
- Added the following lines to check if the base image needs to be redrawn
(redrawing of the base image should only be done if the map pane is on the
top):
if (componentZOrder > 0)
{
redrawBaseImage = false;;
}
My new version of the JMapPane.paintComponent() method looks like this:
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (acceptRepaintRequests) {
if (curPaintArea == null ||
context == null ||
context.getLayerCount() == 0 ||
renderer == null) {
return;
}
JRootPane rootPane = getRootPane();
JInternalFrame internalFrame =
(JInternalFrame)rootPane.getParent();
JDesktopPane desktopPane =
(JDesktopPane)internalFrame.getParent();
int componentZOrder =
desktopPane.getComponentZOrder(internalFrame);
if (componentZOrder > 0)
{
redrawBaseImage = false;;
}
if (needNewBaseImage) {
baseImage = new BufferedImage(
curPaintArea.width + 1, curPaintArea.height + 1,
BufferedImage.TYPE_INT_ARGB);
if (baseImageGraphics != null) {
baseImageGraphics.dispose();
}
baseImageGraphics = baseImage.createGraphics();
needNewBaseImage = false;
redrawBaseImage = true;
clearLabelCache = true;
}
final ReferencedEnvelope mapAOI = context.getAreaOfInterest();
if (mapAOI == null) {
return;
}
if (redrawBaseImage) {
if (baseImageMoved) {
afterImageMove(mapAOI, curPaintArea);
baseImageMoved = false;
clearLabelCache = true;
}
if (renderingExecutor.submit(mapAOI, curPaintArea,
baseImageGraphics)) {
MapPaneEvent ev = new MapPaneEvent(this,
MapPaneEvent.Type.RENDERING_STARTED);
publishEvent(ev);
} else {
onRenderingRejected();
}
} else {
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(baseImage, imageOrigin.x, imageOrigin.y, null);
}
redrawBaseImage = true;
}
}
Thanks,
Richard
--
View this message in context:
http://n2.nabble.com/JMapPane-bleeding-through-JInternalFrame-tp4891979p4897997.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users