本文整理汇总了Java中java.awt.geom.NoninvertibleTransformException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java NoninvertibleTransformException.printStackTrace方法的具体用法?Java NoninvertibleTransformException.printStackTrace怎么用?Java NoninvertibleTransformException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.NoninvertibleTransformException
的用法示例。
在下文中一共展示了NoninvertibleTransformException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createImageProjected
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
/**
* Modify the GeometricLayer so the layer coordinate system matches the image coordinate system ("pixel" projection).
*/
public static GeometryImage createImageProjected(GeometryImage layer, AffineTransform geoTransform) {
for(Geometry geom:layer.geoms){
for(Coordinate pos:geom.getCoordinates()){
Point2D.Double temp=new Point2D.Double();
try {
geoTransform.inverseTransform(new Point2D.Double(pos.x, pos.y),temp);
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
pos.x=temp.x;
pos.y=temp.y;
}
}
return layer;
}
示例2: transform
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
public void transform(AffineTransform tx)
{
if (transform == null)
transform = new AffineTransform(tx);
else
transform.concatenate(tx);
if (clip != null)
{
try
{
AffineTransform clipTransform = tx.createInverse();
updateClip(clipTransform);
}
catch (NoninvertibleTransformException ex)
{
// TODO: How can we deal properly with this?
ex.printStackTrace();
}
}
setTransformImpl(transform);
}
示例3: fill
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
/**
* @param geometry
* geometry to fill
* @param viewport
* viewport
* @param graphics
* graphics to draw into
*/
@SuppressWarnings("unchecked")
public static void fill(final IGeometry geometry, final Viewport viewport,
final Graphics2D graphics, double opacity) {
if (geometry.isPolygon()) {
try {
Shape shape = viewport.toShape(geometry);
if (shape != null) {
graphics.fill(shape);
}
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
} else {
if (geometry.isMultiSurface()) {
GM_Aggregate<IGeometry> aggregate = (GM_Aggregate<IGeometry>) geometry;
for (IGeometry element : aggregate) {
RenderUtil.fill(element, viewport, graphics, opacity);
}
}
}
}
示例4: addRoadNetworkTxtLayer
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
@Override
public final void addRoadNetworkTxtLayer(final String fileName) {
int lastIndexOfSeparator = fileName.lastIndexOf(File.separatorChar);
String populationName = fileName.substring(lastIndexOfSeparator + 1, fileName.lastIndexOf(".")); //$NON-NLS-1$
logger.info(populationName);
Population<DefaultFeature> population = RoadNetworkTextfileReader.read(fileName, populationName,
this.getDataSet(), true);
logger.info(population.size());
if (population != null) {
this.addFeatureCollection(population, population.getNom());
if (this.getLayers().size() == 1) {
try {
this.getLayerViewPanel().getViewport().zoom(population.envelope());
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}
}
}
}
示例5: mouseDragged
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
/**
* Handles mouse drag events, related to moving the knob.
* The knob's motion is constrained so that it behaves like a JSlider.
* All calculations are performed relative to a slider in its default
* (horizontal) orientation.
*
* @param event the MouseEvent
*/
@Override public void mouseDragged( MouseEvent event ) {
// Inverse transform the mouse coordinates to match a slider in its default (horizontal) orientation.
int mouseX = 0;
try {
AffineTransform transform = getNetTransform();
transform.inverseTransform( event.getPoint(), _somePoint /* output */ );
mouseX = (int) _somePoint.getX();
}
catch ( NoninvertibleTransformException e ) {
e.printStackTrace();
}
// Constrain the knob position to the drag boundaries.
int x = (int) Math.max( _dragBounds.x, Math.min( _dragBounds.x + _dragBounds.width, mouseX ) );
// Determine the value that corresponds to the constrained location.
double percent = ( x - _dragBounds.x ) / (double) ( _dragBounds.width );
int value = (int) ( percent * ( _maximum - _minimum ) ) + _minimum;
// Set the new value.
setValue( value );
}
示例6: setScale
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
/**
* Set a new Scale to the viewport.
*
* @param newScale
* new scale of the viewport
*/
public final void setScale(final double newScale) {
IDirectPosition center = this.getEnvelopeInModelCoordinates().center();
this.scale = newScale;
// update the spacing in the adapter factory (used to approximate curves
// such as bezier)
AdapterFactory.setSpacing(this.getSpacingInPixels() / this.getScale());
Point2D modelPoint = new Point2D.Double(center.getX(), center.getY());
LayerViewPanel lvp = this.layerViewPanels.iterator().next();
modelPoint.setLocation(modelPoint.getX() - lvp.getWidth()
/ (2 * this.scale), modelPoint.getY() - lvp.getHeight()
/ (2 * this.scale));
this.viewOrigin.setLocation(modelPoint);
try {
this.update();
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
}
示例7: addGpsTxtLayer
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
@Override
public final void addGpsTxtLayer(final String fileName) {
int lastIndexOfSeparator = fileName.lastIndexOf(File.separatorChar);
String populationName = fileName.substring(lastIndexOfSeparator + 1, fileName.lastIndexOf(".")); //$NON-NLS-1$
logger.info(populationName);
Population<DefaultFeature> population = GPSTextfileReader.read(fileName, populationName, this.getDataSet(),
true);
logger.info(population.size());
if (population != null) {
this.addFeatureCollection(population, population.getNom());
if (this.getLayers().size() == 1) {
try {
this.getLayerViewPanel().getViewport().zoom(population.envelope());
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}
}
}
}
示例8: draw
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
public void draw(Graphics2D g){
Color originalColor = g.getColor();
g.setColor(Color.ORANGE);
AffineTransform af = new AffineTransform();
af.translate(x, y);
g.transform(af);
g.fill(shape);
try {
g.transform(af.createInverse());
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
g.setColor(originalColor);
}
示例9: getNativePointSize
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
private int getNativePointSize() {
/* Make a copy of the glyphTX in which we will store the
* font transform, inverting the devTx if necessary
*/
double[] mat = new double[4];
desc.glyphTx.getMatrix(mat);
fontTx = new AffineTransform(mat);
/* Now work backwards to get the font transform */
if (!desc.devTx.isIdentity() &&
desc.devTx.getType() != AffineTransform.TYPE_TRANSLATION) {
try {
invertDevTx = desc.devTx.createInverse();
fontTx.concatenate(invertDevTx);
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
}
/* At this point the fontTx may be a simple +ve scale, or it
* may be something more complex.
*/
Point2D.Float pt = new Point2D.Float(1f,1f);
fontTx.deltaTransform(pt, pt);
double ptSize = Math.abs(pt.y);
int ttype = fontTx.getType();
if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
fontTx.getScaleY() <= 0) {
/* We need to create an inverse transform that doesn't
* include the point size (strictly the uniform scale)
*/
fontTx.scale(1/ptSize, 1/ptSize);
} else {
fontTx = null; // no need
}
return (int)ptSize;
}
示例10: updatePoints
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
private void updatePoints(int x, int y) {
Point2D inv = new Point2D.Double(x, y);
try {
inv = transform.inverseTransform(inv, null);
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
x = (int)inv.getX();
y = (int)inv.getY();
switch (paintType) {
default:
case BASIC:
case LINEAR:
// pick the closest point to move
if (inv.distance(startX, startY) < inv.distance(endX, endY)) {
startX = x;
startY = y;
} else {
endX = x;
endY = y;
}
break;
case RADIAL:
// pick the closest point to move
if (inv.distance(ctrX, ctrY) < inv.distance(focusX, focusY)) {
ctrX = x;
ctrY = y;
} else {
focusX = x;
focusY = y;
}
break;
}
updatePaint();
}
示例11: mousePressed
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
@Override
public void mousePressed(final MouseEvent e) {
ProjectFrame frame = this.mainFrame.getSelectedProjectFrame();
if ((SwingUtilities.isLeftMouseButton(e))) {
try {
DirectPosition p = frame.getLayerViewPanel().getViewport()
.toModelDirectPosition(e.getPoint());
this.selectPoint(p);
this.dragCount = 0;
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}
}
}
示例12: convertToWorld
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
public Point convertToWorld( Point2D screenPt ) {
AffineTransform affineTransform = getTransform();
Point2D out = null;
try {
out = affineTransform.inverseTransform( screenPt, null );//todo ignores registration point.
}
catch ( NoninvertibleTransformException e ) {
e.printStackTrace();
}
return new Point( (int) out.getX(), (int) out.getY() );
}
示例13: mousePressed
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
@Override
public void mousePressed(final MouseEvent e) {
ProjectFrame frame = this.mainFrame.getSelectedProjectFrame();
if ((SwingUtilities.isLeftMouseButton(e))) {
try {
DirectPosition p = frame.getLayerViewPanel().getViewport()
.toModelDirectPosition(e.getPoint());
this.initialPoint = p;
this.currentPoint = p;
this.dragCount = 0;
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}
}
}
示例14: buildTileImage
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
private BufferedImage buildTileImage() {
ProjectFrame pf = this.application.getMainFrame().getSelectedProjectFrame();
LayerViewAwtPanel lvawt = (LayerViewAwtPanel) pf.getLayerViewPanel();
Color bg = pf.getLayerViewPanel().getBackground();
BufferedImage outImage = new BufferedImage(this.largeur, this.hauteur,
BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = outImage.createGraphics();
graphics.setColor(bg);
graphics.fillRect(0, 0, largeur, hauteur);
// lvawt.setSize(largeur, hauteur);
addDataLayers();
addRasters();
LayerViewPanel lvp = pf.getLayerViewPanel();
try {
lvp.getViewport().zoom(this.currentTileBuff);
lvp.repaint();
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
System.out.println("finished rasters, now waiting 2 secs");
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
while (pf.getLayerViewPanel().getRenderingManager().isRendering()) {
; /* do nothing until the rendering is finished */
}
lvawt.getRenderingManager().copyTo(graphics);
return outImage;
}
示例15: leftMouseButtonClicked
import java.awt.geom.NoninvertibleTransformException; //导入方法依赖的package包/类
@Override
public void leftMouseButtonClicked(final MouseEvent e,
final ProjectFrame frame) {
try {
DirectPosition p = frame.getLayerViewPanel().getViewport()
.toModelDirectPosition(e.getPoint());
this.getGeometryToolBar().addPoint(p);
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}
}