Compare commits

...

2 Commits

Author SHA1 Message Date
Eyck Jentzsch 20c3994507 Initial plugin version 2018-08-27 23:11:59 +02:00
Eyck Jentzsch 73c257af03 Added UI support for real value signals 2018-08-27 16:27:11 +02:00
18 changed files with 239 additions and 44 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.minres.scviewer.database.binary</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
enabled=true
path=OSGI-INF
validationErrorLevel=error
validationErrorLevel.missingImplicitUnbindMethod=error

View File

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Binary Database
Bundle-SymbolicName: com.minres.scviewer.database.binary
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.osgi.framework.console;version="1.0.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.component.annotations;version="1.2.0";resolution:="optional",
org.osgi.util.tracker;version="1.3.1"
Automatic-Module-Name: com.minres.scviewer.database.binary
Service-Component: OSGI-INF/*.xml
Require-Bundle: com.minres.scviewer.database

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="BinaryDbLoader">
<implementation class="com.minres.scviewer.database.binary.BinaryDbLoader"/>
<service>
<provide interface="com.minres.scviewer.database.IWaveformDbLoader"/>
</service>
</scr:component>

View File

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/

View File

@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.binary;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
public class BinaryDbLoader implements IWaveformDbLoader {
private List<RelationType> usedRelationsList = new ArrayList<>();
private IWaveformDb db;
public BinaryDbLoader() {
}
@Override
public Long getMaxTime() {
return 0L;
}
@Override
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
List<IWaveform<? extends IWaveformEvent>> streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
return streams;
}
@Override
public boolean load(IWaveformDb db, File file) throws Exception {
return false;
}
@Override
public Collection<RelationType> getAllRelationTypes(){
return usedRelationsList;
}
}

View File

@ -25,6 +25,7 @@ import org.eclipse.swt.graphics.Rectangle;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ISignalChangeReal;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors;
@ -107,8 +108,13 @@ public class SignalPainter extends TrackPainter {
NavigableMap<Long, ? extends ISignalChange> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
SignalChange left = new SignalChange(first);
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
SignalStencil stencil = left.value instanceof ISignalChangeSingle ? new SingleBitStencil() : new MultiBitStencil(gc);
SignalStencil stencil = null;
if(left.value instanceof ISignalChangeSingle)
stencil= new SingleBitStencil();
else if(left.value instanceof ISignalChangeMulti)
stencil= new MultiBitStencil(gc);
else
stencil= new RealStencil(left.value, entries);
maxX = area.x + area.width;
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
@ -122,7 +128,6 @@ public class SignalPainter extends TrackPainter {
// b) left to close to right
if (left.time == right.time) {
right.time = endTime;
} else {
multiple = true;
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
@ -144,7 +149,9 @@ public class SignalPainter extends TrackPainter {
if (xEnd == xBegin) {
multiple = true;
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
right.set(entries.floorEntry(eTime), endTime);
Entry<Long, ? extends ISignalChange> entry = entries.floorEntry(eTime);
if(entry!=null && entry.getKey()> right.time)
right.set(entry, endTime);
xEnd = getXEnd(eTime);
}
} while (left.time < endTime);
@ -254,7 +261,84 @@ public class SignalPainter extends TrackPainter {
}
}
}
}
private class RealStencil implements SignalStencil {
double min;
double max;
double diff;
public RealStencil(ISignalChange value, NavigableMap<Long, ? extends ISignalChange> entries) {
min=((ISignalChangeReal) value).getValue();
max=min;
for (ISignalChange e : entries.values()) {
double v = ((ISignalChangeReal)e).getValue();
max= Double.isNaN(max)? v : Math.max(max, v);
min= Double.isNaN(min)? v : Math.min(min, v);
}
int nans = (Double.isNaN(max)?2:0) + (Double.isNaN(max)?1:0);
switch(nans) {
case 0:
break;
case 1:
max=min;
break;
case 2:
min=max;
case 3:
max=min=0;
}
diff=max-min;
if(diff==0.0) {
if(max>0)
min=0.0;
else if(min<0.0)
max=0.0;
else {
max=1.0;
min=0.0;
}
diff=max-min;
}
}
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
double value = ((ISignalChangeReal)left).getValue();
if(Double.isNaN(value)) {
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
int width = xEnd - xBegin;
if (width > 1) {
int[] points = {
xBegin, yOffsetT,
xEnd, yOffsetT,
xEnd, yOffsetB,
xBegin, yOffsetB
};
gc.setForeground(color);
gc.drawPolygon(points);
gc.setBackground(color);
gc.fillPolygon(points);
} else {
gc.setForeground(color);
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
}
} else {
Color color = waveCanvas.colors[WaveformColors.SIGNAL_ANALOG.ordinal()];
int height=yOffsetT-yOffsetB;
double offset=value-min;
int yOffset=diff>0?(int)(height*(offset/diff)) + yOffsetB:yOffsetM;
gc.setForeground(color);
if (xEnd > maxX) {
gc.drawLine(xBegin, yOffset, maxX, yOffset);
} else {
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
double nextOffset = ((ISignalChangeReal)right).getValue()-min;
int yNext = diff>0?(int)(height*(nextOffset/diff)) + yOffsetB:height/2;
if (yOffset != yNext)
gc.drawLine(xEnd, yOffset, xEnd, yNext);
}
}
}
}
public ISignal<? extends ISignalChange> getSignal() {

View File

@ -156,6 +156,8 @@ public class WaveformCanvas extends Canvas {
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.SIGNAL_ANALOG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);

View File

@ -72,6 +72,7 @@ import com.google.common.collect.Lists;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ISignalChangeReal;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxEvent;
@ -458,6 +459,8 @@ public class WaveformViewer implements IWaveformViewer {
entry.setValue("b'"+((ISignalChangeSingle)event).getValue());
} else if(event instanceof ISignalChangeMulti){
entry.setValue("h'"+((ISignalChangeMulti)event).getValue().toHexString());
} else if(event instanceof ISignalChangeReal){
entry.setValue(Double.toString(((ISignalChangeReal)event).getValue()));
}
} else if(entry.getKey() instanceof ITxStream<?>){
ITxStream<?> stream = (ITxStream<?>) entry.getKey();

View File

@ -14,7 +14,7 @@ public enum WaveformColors {
LINE, LINE_HIGHLITE,
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT,
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_ANALOG, SIGNAL_NAN,
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
}

View File

@ -46,6 +46,8 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
colors[WaveformColors.SIGNAL_ANALOG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.eclipse.e4.ui.workbench.swt.E4Application"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="false"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/SCViewer (restart)"/>
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-com.minres.scviewer.e4.application.product"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clearPersistedState -data @none"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx4G -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default,com.opcoach.e4.preferences@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="true"/>
<booleanAttribute key="usefeatures" value="false"/>
</launchConfiguration>

View File

@ -9,7 +9,7 @@
<repository location="http://download.eclipse.org/releases/neon"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.codehaus.groovy24.feature.feature.group" version="2.9.2.xx-201701211811-e46"/>
<unit id="org.codehaus.groovy24.feature.feature.group" version="2.9.3.xx-201806261157-e46"/>
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.6"/>
</location>
</locations>
@ -17,8 +17,7 @@
<arch>x86_64</arch>
<nl>de_DE</nl>
</environment>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 7 [1.7.0_45]"/>
<launcherArgs>
<vmArgs>-Dosgi.requiredJavaVersion=1.6 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgs>
<vmArgs>-Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256 -Xms40m -Xmx2G </vmArgs>
</launcherArgs>
</target>
</target>

View File

@ -1,2 +1,3 @@
eclipse.preferences.version=1
groovy.compiler.level=23
groovy.compiler.level=24
groovy.script.filters=**/*.dsld,y,**/*.gradle,n