Coordinate c2 = context.getMap().getViewportModel().pixelToWorld(end.x, end.y);
Envelope newRegionBounds = new Envelope(c1, c2);
ILayer processingRegionLayer = OmsBoxPlugin.getDefault().getProcessingRegionMapGraphic();
IStyleBlackboard blackboard = processingRegionLayer.getStyleBlackboard();
ProcessingRegionStyle style = (ProcessingRegionStyle) blackboard.get(ProcessingRegionStyleContent.ID);
if (style == null) {
style = ProcessingRegionStyleContent.createDefault();
}
ProcessingRegion processinRegion = new ProcessingRegion(style.west, style.east, style.south, style.north,
style.rows, style.cols);
ProcessingRegion newProcessingRegion = ProcessingRegion.adaptActiveRegionToEnvelope(newRegionBounds,
processinRegion);
style.north = newProcessingRegion.getNorth();
style.south = newProcessingRegion.getSouth();
style.east = newProcessingRegion.getEast();
style.west = newProcessingRegion.getWest();
style.rows = newProcessingRegion.getRows();
style.cols = newProcessingRegion.getCols();
blackboard.put(ProcessingRegionStyleContent.ID, style);
processingRegionLayer.refresh(null);
newRegionBounds = newProcessingRegion.getEnvelope();
sendSelectionCommand(e, newRegionBounds);