Package net.sf.latexdraw.glib.models.interfaces.shape

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IText




  @Test
  public void testRPutCoordStarFloatText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{*-90.8929}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(90.8929), txt.getRotationAngle(), 0.001);
  }
View Full Code Here


  }


  @Test
  public void testRPutCoordStarSignedIntText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{*-++-90}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-90.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

  }


  @Test
  public void testRPutCoordStarIntText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{*90}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-90.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

  }


  @Test
  public void testRPutCoordRotationRText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{R}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-270.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

  }


  @Test
  public void testRPutCoordRotationDText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{D}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-180.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

  }


  @Test
  public void testRPutCoordRotationLText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{L}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-90.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

  }


  @Test
  public void testRPutCoordRotationUText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{U}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(0., txt.getRotationAngle(), 0.001);
  }
View Full Code Here

    assertEquals(0., txt.getRotationAngle(), 0.001);
  }

  @Test
  public void testRPutCoordRotationEText() throws ParseException {
    IText txt = (IText)parser.parsePSTCode("\\rput{E}(1,2){coucou}").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals("coucou", txt.getText()); //$NON-NLS-1$
    assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2.*IShape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-270.), txt.getRotationAngle(), 0.001);
  }
View Full Code Here

    final IPoint textPosition = instrument.relativePoint==null ? ShapeFactory.createPoint(instrument.textField.getX(),
                  instrument.textField.getY()+instrument.textField.getHeight()) : instrument.relativePoint;
    final IShape sh = instrument.pencil==null ? null : instrument.pencil.createShapeInstance();

    if(sh instanceof IText) {
      final IText text = (IText)sh;
      text.setPosition(textPosition.getX(), textPosition.getY());
      text.setText(instrument.textField.getText());
      action.setShape(text);
      action.setDrawing(instrument.pencil.canvas().getDrawing());
    }
  }
View Full Code Here

      // Updating the log field.
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          IText txt = null;
          for(int i=0, size=shape.size(); i<size && txt==null; i++) //TODO closure
            if(shape.getShapeAt(i) instanceof IText)
              txt = (IText)shape.getShapeAt(i);
          if(txt!=null) {
            final int max = 10;
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.glib.models.interfaces.shape.IText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.