@Test public void nanoPlotSubclassIsNanoPlot() { class FemtoPlot extends NanoPlot { } NanoPlot plot = new FemtoPlot(); Assertions.assertThat(NanoPlot.isNanoPlotClass(plot.getClass())).isTrue(); }
@Override public void serialize(Text text, JsonGenerator jgen, SerializerProvider sp) throws IOException, JsonProcessingException { boolean isNanoPlot = NanoPlot.isNanoPlotClass(text.getPlotType()); jgen.writeStartObject(); jgen.writeObjectField(TYPE, SerializerUtil.getTypeName(text)); jgen.writeObjectField("x", isNanoPlot ? processLargeNumber(text.getX()) : text.getX()); jgen.writeObjectField("y", text.getY()); jgen.writeObjectField("show_pointer", text.getShowPointer()); jgen.writeObjectField("text", text.getText()); jgen.writeObjectField("pointer_angle", text.getPointerAngle()); jgen.writeObjectField("color", text.getColor()); jgen.writeObjectField("size", text.getSize()); jgen.writeEndObject(); }
@Override public void serialize(ConstantBand constantBand, JsonGenerator jgen, SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); boolean isNanoPlot = NanoPlot.isNanoPlotClass(constantBand.getPlotType()); jgen.writeObjectField(TYPE, SerializerUtil.getTypeName(constantBand)); jgen.writeObjectField("x", isNanoPlot ? processLargeNumbers(constantBand.getX()) : constantBand.getX()); jgen.writeObjectField("y", constantBand.getY()); jgen.writeObjectField("visible", constantBand.getVisible()); jgen.writeObjectField("yAxis", constantBand.getYAxis()); if (constantBand.getColor() == null){ jgen.writeObjectField("color", new Color(0, 127, 255, 127)); }else{ jgen.writeObjectField("color", constantBand.getColor()); } jgen.writeEndObject(); }
@Override public void serialize(ConstantLine constantLine, JsonGenerator jgen, SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); boolean isNanoPlot = NanoPlot.isNanoPlotClass(constantLine.getPlotType()); jgen.writeObjectField(TYPE, SerializerUtil.getTypeName(constantLine)); jgen.writeObjectField("x", isNanoPlot ? processLargeNumber(constantLine.getX()) : constantLine.getX()); jgen.writeObjectField("y", constantLine.getY()); jgen.writeObjectField("visible", constantLine.getVisible()); jgen.writeObjectField("yAxis", constantLine.getYAxis()); jgen.writeObjectField("showLabel", constantLine.getShowLabel()); if (constantLine.getWidth() != null) { jgen.writeObjectField("width", constantLine.getWidth()); } if (constantLine.getStyle() != null) { jgen.writeObjectField("style", constantLine.getStyle().toString()); } if (constantLine.getColor() instanceof Color) { jgen.writeObjectField("color", constantLine.getColor()); } jgen.writeEndObject(); }
@Override public void serialize(T xyGraphics, JsonGenerator jgen, SerializerProvider sp) throws IOException { validate(xyGraphics); super.serialize(xyGraphics, jgen, sp); boolean isNanoPlot = NanoPlot.isNanoPlotClass(xyGraphics.getPlotType()); jgen.writeObjectField("x", isNanoPlot ? processLargeNumbers(xyGraphics.getX()) : xyGraphics.getX()); jgen.writeObjectField("y", xyGraphics.getY()); jgen.writeObjectField(DISPLAY_NAME, xyGraphics.getDisplayName()); if (xyGraphics.getLodFilter() != null){ jgen.writeObjectField("lod_filter", xyGraphics.getLodFilter().getText()); } List<String> toolTips = xyGraphics.getToolTips(); if (toolTips != null) { jgen.writeObjectField("tooltips", toolTips); } }