replace System.err.print(ln) by Apache Logger

This commit is contained in:
Martin Pernollet 2015-10-18 17:48:30 +02:00
parent 3f34c70904
commit da7e291060
13 changed files with 26 additions and 49 deletions

View File

@ -3,6 +3,7 @@ package org.jzy3d.chart;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
import org.jzy3d.maths.Rectangle;
@ -11,6 +12,8 @@ import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
public class ChartLauncher {
static Logger logger = Logger.getLogger(ChartLauncher.class);
public static String SCREENSHOT_FOLDER = "./data/screenshots/";
public static ICameraMouseController openChart(Chart chart) {
@ -91,10 +94,10 @@ public class ChartLauncher {
TextureData screen = chart.screenshot();
if(screen!=null){
TextureIO.write(screen, new File(filename));
System.out.println("Dumped screenshot in: " + filename);
logger.info("Dumped screenshot in: " + filename);
}
else{
System.err.println("screenshot not available");
logger.error("screenshot not available");
}
}
}

View File

@ -196,7 +196,7 @@ public class ChartComponentFactory implements IChartComponentFactory {
return newFrameSwing(chart, bounds, title);
else {
String m = "No default frame could be found for the given Chart canvas: " + canvas.getClass();
System.err.println(m);
logger.error(m);
return null;
// throw new RuntimeException(m);
}

View File

@ -189,8 +189,6 @@ public class AxeBox implements IAxe {
BoundingBox3d bbox = drawTicks(gl, glu, camera, xselect, AXE_X, layout.getXTickColor());
wholeBounds.add(bbox);
} else {
// System.err.println("no x axe selected: " +
// Arrays.toString(quadIsHidden));
// HACK: handles "on top" view, when all face of cube are
// drawn, which forbid to select an axe automatically
BoundingBox3d bbox = drawTicks(gl, glu, camera, 2, AXE_X, layout.getXTickColor(), Halign.CENTER, Valign.TOP);
@ -211,8 +209,6 @@ public class AxeBox implements IAxe {
BoundingBox3d bbox = drawTicks(gl, glu, camera, yselect, AXE_Y, layout.getYTickColor());
wholeBounds.add(bbox);
} else {
// System.err.println("no y axe selected: " +
// Arrays.toString(quadIsHidden));
// HACK: handles "on top" view, when all face of cube are
// drawn, which forbid to select an axe automatically
BoundingBox3d bbox = drawTicks(gl, glu, camera, 1, AXE_Y, layout.getYTickColor(), Halign.RIGHT, Valign.GROUND);

View File

@ -2,6 +2,7 @@ package org.jzy3d.plot3d.primitives.axes;
import java.nio.FloatBuffer;
import org.apache.log4j.Logger;
import org.jzy3d.maths.BoundingBox3d;
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
@ -18,6 +19,8 @@ import com.jogamp.opengl.GL2;
* @author Martin Pernollet
*/
public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
static Logger logger = Logger.getLogger(FeedbackBufferAxeBox.class);
public FeedbackBufferAxeBox(BoundingBox3d bbox){
super(bbox);
}
@ -90,7 +93,7 @@ public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
count--;
if(printout)
System.out.println("GL.GL_PASS_THROUGH_TOKEN: " + passthrough_value);
logger.info("GL.GL_PASS_THROUGH_TOKEN: " + passthrough_value);
// If the preceding token is also a GL_PASS_THROUGH_TOKEN
// we consider it as an empty token
@ -109,7 +112,7 @@ public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
// Other cases: just consume buffer
else if (token_type == GL2.GL_POINT_TOKEN) {
if(printout){
System.out.println(" GL.GL_POINT_TOKEN");
logger.info(" GL.GL_POINT_TOKEN");
count = print3DcolorVertex(size, count, buffer);
}else{
count = count - 7;
@ -117,7 +120,7 @@ public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
}
else if (token_type == GL2.GL_LINE_TOKEN) {
if(printout){
System.out.println(" GL.GL_LINE_TOKEN ");
logger.info(" GL.GL_LINE_TOKEN ");
count = print3DcolorVertex(size, count, buffer);
count = print3DcolorVertex(size, count, buffer);
}else{
@ -126,7 +129,7 @@ public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
}
else if (token_type == GL2.GL_LINE_RESET_TOKEN) {
if(printout){
System.out.println(" GL.GL_LINE_RESET_TOKEN ");
logger.info(" GL.GL_LINE_RESET_TOKEN ");
count = print3DcolorVertex(size, count, buffer);
count = print3DcolorVertex(size, count, buffer);
}else{
@ -138,7 +141,7 @@ public class FeedbackBufferAxeBox extends AxeBox implements IAxe{
count--;
if(printout)
System.out.println(" GL.GL_POLYGON_TOKEN: " + n + " vertices");
logger.info(" GL.GL_POLYGON_TOKEN: " + n + " vertices");
for(int i=0; i<n; i++){
if(printout)

View File

@ -73,8 +73,7 @@ public class ProjectionUtils {
// sort according to z
t.tic();
Collections.sort(polygonProjections, new ProjectionComparator());
t.toc(); report += " Sort :" + t.elapsedMilisecond();
System.out.println(report);
t.tocShow(report+ " Sort : ");
return polygonProjections;
}

View File

@ -60,7 +60,6 @@ public class Renderer3d implements GLEventListener {
*/
@Override
public void init(GLAutoDrawable canvas) {
// System.err.println("init");
if (canvas != null && canvas.getGL() != null && canvas.getGL().getGL2() != null && view != null) {
if (debugGL)
canvas.getGL().getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Debug", null, canvas.getGL(), null));
@ -95,7 +94,6 @@ public class Renderer3d implements GLEventListener {
/** Called when the {@link GLAutoDrawable} is resized. */
@Override
public void reshape(GLAutoDrawable canvas, int x, int y, int width, int height) {
// System.err.println("reshape with " + width + " " + height);
this.width = width;
this.height = height;

View File

@ -212,21 +212,6 @@ public class AWTChartComponentFactory extends ChartComponentFactory {
@Override
public IFrame newFrame(Chart chart, Rectangle bounds, String title) {
/*
* Object canvas = chart.getCanvas();
*
* if (canvas.getClass().getName().equals(
* "org.jzy3d.plot3d.rendering.canvas.CanvasAWT")) return
* newFrameAWT(chart, bounds, title, null); // FrameSWT works as well
* else if (canvas instanceof CanvasNewtAwt) return newFrameAWT(chart,
* bounds, title, "[Newt]"); // FrameSWT works as well else if
* (canvas.getClass
* ().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasSwing"))
* return newFrameSwing(chart, bounds, title); else { String m =
* "No default frame could be found for the given Chart canvas: " +
* canvas.getClass(); System.err.println(m); return null; // throw new
* RuntimeException(m); }
*/
return newFrameAWT(chart, bounds, title, null);
}
}

View File

@ -16,11 +16,11 @@ public class CustomEventQueue extends EventQueue {
@Override
protected void dispatchEvent(AWTEvent event) {
if (event instanceof PaintEvent)
;// System.out.println("Dispatch [PAINT]: "+event);
logger.info("Dispatch [PAINT]: "+event);
else if (event instanceof MouseEvent)
;// System.out.println("Dispatch [MOUSE]: "+event);
logger.info("Dispatch [MOUSE]: "+event);
else if (event instanceof InvocationEvent) {
;// System.out.println("Dispatch [INVOC]: "+event);
logger.info("Dispatch [INVOC]: "+event);
} else
logger.warn("Dispatch [UNKNO]: " + event);

View File

@ -28,7 +28,8 @@ public class GLErrorReader {
boolean status = true; // assume an error
if(err==GL.GL_NO_ERROR){
status = false;//System.out.println("No error has been recorded. The value of this symbolic constant is guaranteed to be zero.");
//No error has been recorded. The value of this symbolic constant is guaranteed to be zero.
status = false;
}
else if(err==GL.GL_INVALID_ENUM){
logger.error("GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument. The offending command is ignored, having no side effect other than to set the error flag.");

View File

@ -67,7 +67,6 @@ public class CanvasAWT extends GLCanvas implements IScreenCanvas {
new Thread(new Runnable() {
@Override
public void run() {
// System.err.println("stopping canvas animator");
if (animator != null)
animator.stop();
renderer = null;

View File

@ -77,7 +77,6 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas {
new Thread(new Runnable() {
@Override
public void run() {
// System.err.println("stopping canvas animator");
if (animator != null && animator.isStarted()) {
animator.stop();
}

View File

@ -78,8 +78,7 @@ public class EventRecorder extends Timestamped implements MouseListener, MouseMo
try {
scenario.save();
} catch (Exception e) {
System.err.println(e);
Logger.getLogger(EventRecorder.class).error(e);
logger.error(e);
}
}

View File

@ -38,7 +38,7 @@ public class EventReplay extends Timestamped{
public EventReplay(final Component component, Frame frame){
/*component.addMouseListener(new MouseAdapter(){
public void mouseDragged(MouseEvent e){
System.err.println("DRAGGING");
logger.info("DRAGGING");
}
});*/
this.component = component;
@ -125,23 +125,18 @@ public class EventReplay extends Timestamped{
getRobot().mousePress(mouse.getButton());
else if(type==MouseEventType.MOUSE_PRESSED){
//System.err.println("robot press");
getRobot().mousePress(mouse.getButton());
}
else if(type==MouseEventType.MOUSE_RELEASED){
//System.err.println("robot released");
getRobot().mouseRelease(mouse.getButton());
}
else if(type==MouseEventType.MOUSE_DRAGGED){
//System.err.println("robot moved (dragged)");
getRobot().mouseMove(moveX(mouse, insets), moveY(mouse, insets));
}
else if(type==MouseEventType.MOUSE_MOVED){
//System.err.println("robot moved");
getRobot().mouseMove(moveX(mouse, insets), moveY(mouse, insets));
}
else if(type==MouseEventType.MOUSE_WHEEL){
//System.err.println("robot wheel");
getRobot().mouseWheel(mouse.getValue());
}
@ -165,10 +160,10 @@ public class EventReplay extends Timestamped{
else if(key.getType()==KeyEventType.KEY_RELEASE)
doKeyRelease(key);
else
System.err.println("ignore key event " + key);
logger.warn("ignore key event " + key);
}
else
System.err.println("ignore key event " + key + " because keycode=0");
logger.warn("ignore key event " + key + " because keycode=0");
}
catch(Exception e){
log(key);
@ -287,13 +282,13 @@ MOUSE_MOVED, x:107, y:55, bt:0, since:3899
component.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
System.err.println("ASSERT DRAGGED CALLED ON COMPONENT");
logger.info("ASSERT DRAGGED CALLED ON COMPONENT");
}
});
component.addMouseListener(new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
System.err.println("ASSERT MOVED CALLED ON COMPONENT");
logger.info("ASSERT MOVED CALLED ON COMPONENT");
}
});
}