Updated configuration and led-display

Former-commit-id: a768b70fa40c1b78da9e7b7c6380734211b28bf5
This commit is contained in:
T. van der Zwan 2013-09-25 09:24:00 +02:00
parent b1b6de7ce6
commit 7c15c97904
9 changed files with 271 additions and 179 deletions

View File

@ -5,6 +5,7 @@ import java.awt.geom.Rectangle2D;
import java.util.Vector;
import org.hyperion.config.spec.BorderSide;
import org.hyperion.config.spec.ImageProcessConfig;
import org.hyperion.config.spec.Led;
import org.hyperion.config.spec.LedFrameConstruction;
@ -22,9 +23,7 @@ public class LedFrameFactory {
}
public static Vector<Led> construct(LedFrameConstruction frameSpec) {
double overlap_frac = 0.50;
public static Vector<Led> construct(LedFrameConstruction frameSpec, ImageProcessConfig processConfig) {
Vector<Led> mLeds = new Vector<>();
int totalLedCount = frameSpec.getLedCount();
@ -37,7 +36,7 @@ public class LedFrameFactory {
iLed += totalLedCount;
}
if (frameSpec.topLeftCorner) {
mLeds.add(createLed(frameSpec, iLed, 0.0, 0.0, overlap_frac, BorderSide.top_left));
mLeds.add(createLed(frameSpec, processConfig, iLed, 0.0, 0.0, processConfig.overlapFraction, BorderSide.top_left));
iLed = increase(frameSpec, iLed);
}
if (frameSpec.topLedCnt > 0) {
@ -47,12 +46,12 @@ public class LedFrameFactory {
double led_x = ledSpacing/2.0 + iTop * ledSpacing;
double led_y = 0;
mLeds.add(createLed(frameSpec, iLed, led_x, led_y, overlap_frac, BorderSide.top));
mLeds.add(createLed(frameSpec, processConfig, iLed, led_x, led_y, processConfig.overlapFraction, BorderSide.top));
iLed = increase(frameSpec, iLed);
}
}
if (frameSpec.topRightCorner) {
mLeds.add(createLed(frameSpec, iLed, 1.0, 0.0, overlap_frac, BorderSide.top_right));
mLeds.add(createLed(frameSpec, processConfig, iLed, 1.0, 0.0, processConfig.overlapFraction, BorderSide.top_right));
iLed = increase(frameSpec, iLed);
}
if (frameSpec.rightLedCnt > 0) {
@ -62,12 +61,12 @@ public class LedFrameFactory {
double led_x = 1.0;
double led_y = ledSpacing/2.0 + iRight * ledSpacing;
mLeds.add(createLed(frameSpec, iLed, led_x, led_y, overlap_frac, BorderSide.right));
mLeds.add(createLed(frameSpec, processConfig, iLed, led_x, led_y, processConfig.overlapFraction, BorderSide.right));
iLed = increase(frameSpec, iLed);
}
}
if (frameSpec.bottomRightCorner) {
mLeds.add(createLed(frameSpec, iLed, 1.0, 1.0, overlap_frac, BorderSide.bottom_right));
mLeds.add(createLed(frameSpec, processConfig, iLed, 1.0, 1.0, processConfig.overlapFraction, BorderSide.bottom_right));
iLed = increase(frameSpec, iLed);
}
if (frameSpec.bottomLedCnt > 0) {
@ -81,12 +80,12 @@ public class LedFrameFactory {
double led_x = ledSpacing/2.0 + iBottom * ledSpacing;
double led_y = 1.0;
mLeds.add(createLed(frameSpec, iLed, led_x, led_y, overlap_frac, BorderSide.bottom));
mLeds.add(createLed(frameSpec, processConfig, iLed, led_x, led_y, processConfig.overlapFraction, BorderSide.bottom));
iLed = increase(frameSpec, iLed);
}
}
if (frameSpec.bottomLeftCorner) {
mLeds.add(createLed(frameSpec, iLed, 0.0, 1.0, overlap_frac, BorderSide.bottom_left));
mLeds.add(createLed(frameSpec, processConfig, iLed, 0.0, 1.0, processConfig.overlapFraction, BorderSide.bottom_left));
iLed = increase(frameSpec, iLed);
}
if (frameSpec.leftLedCnt > 0) {
@ -96,7 +95,7 @@ public class LedFrameFactory {
double led_x = 0.0;
double led_y = ledSpacing/2.0 + iRight * ledSpacing;
mLeds.add(createLed(frameSpec, iLed, led_x, led_y, overlap_frac, BorderSide.left));
mLeds.add(createLed(frameSpec, processConfig, iLed, led_x, led_y, processConfig.overlapFraction, BorderSide.left));
iLed = increase(frameSpec, iLed);
}
}
@ -104,36 +103,36 @@ public class LedFrameFactory {
return mLeds;
}
private static Led createLed(LedFrameConstruction frameSpec, int seqNr, double x_frac, double y_frac, double overlap_frac, BorderSide pBorderSide) {
private static Led createLed(LedFrameConstruction pFrameSpec, ImageProcessConfig pProcessSpec, int seqNr, double x_frac, double y_frac, double overlap_frac, BorderSide pBorderSide) {
Led led = new Led();
led.mLedSeqNr = seqNr;
led.mLocation = new Point2D.Double(x_frac, y_frac);
led.mSide = pBorderSide;
double widthFrac = (1.0/frameSpec.topLedCnt * (1.0 + overlap_frac))/2.0;
double heightFrac = (1.0/frameSpec.leftLedCnt * (1.0 + overlap_frac))/2.0;
double widthFrac = (1.0/pFrameSpec.topLedCnt * (1.0 + overlap_frac))/2.0;
double heightFrac = (1.0/pFrameSpec.leftLedCnt * (1.0 + overlap_frac))/2.0;
switch (pBorderSide) {
case top_left: {
led.mImageRectangle = new Rectangle2D.Double(0.0, 0.0, frameSpec.verticalDepth, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(0.0, 0.0, pProcessSpec.verticalDepth, pProcessSpec.horizontalDepth);
break;
}
case top_right: {
led.mImageRectangle = new Rectangle2D.Double(1.0-frameSpec.verticalDepth, 0.0, frameSpec.verticalDepth, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.verticalDepth, 0.0, pProcessSpec.verticalDepth, pProcessSpec.horizontalDepth);
break;
}
case bottom_left: {
led.mImageRectangle = new Rectangle2D.Double(0.0, 1.0-frameSpec.horizontalDepth, frameSpec.verticalDepth, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(0.0, 1.0-pProcessSpec.horizontalDepth, pProcessSpec.verticalDepth, pProcessSpec.horizontalDepth);
break;
}
case bottom_right: {
led.mImageRectangle = new Rectangle2D.Double(1.0-frameSpec.verticalDepth, 1.0-frameSpec.horizontalDepth, frameSpec.verticalDepth, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.verticalDepth, 1.0-pProcessSpec.horizontalDepth, pProcessSpec.verticalDepth, pProcessSpec.horizontalDepth);
break;
}
case top:{
double intXmin_frac = Math.max(0.0, x_frac-widthFrac);
double intXmax_frac = Math.min(x_frac+widthFrac, 1.0);
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 0.0, intXmax_frac-intXmin_frac, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 0.0, intXmax_frac-intXmin_frac, pProcessSpec.horizontalDepth);
break;
}
@ -142,19 +141,19 @@ public class LedFrameFactory {
double intXmin_frac = Math.max(0.0, x_frac-widthFrac);
double intXmax_frac = Math.min(x_frac+widthFrac, 1.0);
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 1.0-frameSpec.horizontalDepth, intXmax_frac-intXmin_frac, frameSpec.horizontalDepth);
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 1.0-pProcessSpec.horizontalDepth, intXmax_frac-intXmin_frac, pProcessSpec.horizontalDepth);
break;
}
case left: {
double intYmin_frac = Math.max(0.0, y_frac-heightFrac);
double intYmax_frac = Math.min(y_frac+heightFrac, 1.0);
led.mImageRectangle = new Rectangle2D.Double(0.0, intYmin_frac, frameSpec.verticalDepth, intYmax_frac-intYmin_frac);
led.mImageRectangle = new Rectangle2D.Double(0.0, intYmin_frac, pProcessSpec.verticalDepth, intYmax_frac-intYmin_frac);
break;
}
case right:
double intYmin_frac = Math.max(0.0, y_frac-heightFrac);
double intYmax_frac = Math.min(y_frac+heightFrac, 1.0);
led.mImageRectangle = new Rectangle2D.Double(1.0-frameSpec.verticalDepth, intYmin_frac, frameSpec.verticalDepth, intYmax_frac-intYmin_frac);
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.verticalDepth, intYmin_frac, pProcessSpec.verticalDepth, intYmax_frac-intYmin_frac);
break;
}

View File

@ -7,21 +7,29 @@ import java.util.Vector;
import org.hyperion.config.spec.ColorConfig;
import org.hyperion.config.spec.DeviceConfig;
import org.hyperion.config.spec.ImageProcessConfig;
import org.hyperion.config.spec.Led;
import org.hyperion.config.spec.LedFrameConstruction;
import org.hyperion.config.spec.MiscConfig;
public class LedString {
/** The individual led configuration */
public Vector<Led> leds;
/** The configuration of the output device */
DeviceConfig mDeviceConfig = new DeviceConfig();
public DeviceConfig mDeviceConfig = new DeviceConfig();
/** THe configuration of the 'physical' led frame */
public LedFrameConstruction mLedFrameConfig = new LedFrameConstruction();
/** The configuration of the image processing */
public ImageProcessConfig mProcessConfig = new ImageProcessConfig();
/** The color adjustment configuration */
ColorConfig mColorConfig = new ColorConfig();
public ColorConfig mColorConfig = new ColorConfig();
/** The miscellaneous configuration (bootsequence, blackborder detector, etc) */
MiscConfig mMiscConfig = new MiscConfig();
public MiscConfig mMiscConfig = new MiscConfig();
/** The translation of the led frame construction and image processing to individual led configuration */
public Vector<Led> leds;
public void saveConfigFile(String mFilename) throws IOException {

View File

@ -11,33 +11,25 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.hyperion.config.LedFrameFactory;
import org.hyperion.config.LedString;
import org.hyperion.config.spec.LedFrameConstruction;
public class ConfigPanel extends JPanel {
private final LedFrameConstruction mLedFrameSpec = new LedFrameConstruction();
private final LedString ledString = new LedString();
private final Action mSaveConfigAction = new AbstractAction("Create Hyperion Configuration") {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.showSaveDialog(ConfigPanel.this);
LedString ledString = new LedString();
ledString.leds = LedFrameFactory.construct(mLedFrameSpec);
if (fileChooser.showSaveDialog(ConfigPanel.this) != JFileChooser.APPROVE_OPTION) {
return;
}
try {
ledString.saveConfigFile(fileChooser.getSelectedFile().getAbsolutePath());
} catch (IOException e1) {
@ -54,11 +46,6 @@ public class ConfigPanel extends JPanel {
private JPanel mIntegrationPanel;
private JLabel mHorizontalDepthLabel;
private JSpinner mHorizontalDepthSpinner;
private JLabel mVerticalDepthLabel;
private JSpinner mVerticalDepthSpinner;
private JPanel mSpecificationPanel;
private MiscConfigPanel mMiscPanel;
@ -68,30 +55,21 @@ public class ConfigPanel extends JPanel {
public ConfigPanel() {
super();
mLedFrameSpec.clockwiseDirection = true;
mLedFrameSpec.topLeftCorner = true;
mLedFrameSpec.topRightCorner= true;
mLedFrameSpec.bottomLeftCorner= true;
mLedFrameSpec.bottomRightCorner= true;
mLedFrameSpec.topLedCnt = 16;
mLedFrameSpec.bottomLedCnt = 16;
mLedFrameSpec.leftLedCnt = 7;
mLedFrameSpec.rightLedCnt = 7;
mLedFrameSpec.firstLedOffset = 0;
initialise();
mHyperionTv.setLeds(LedFrameFactory.construct(mLedFrameSpec));
mLedFrameSpec.addObserver(new Observer() {
ledString.leds = LedFrameFactory.construct(ledString.mLedFrameConfig, ledString.mProcessConfig);
mHyperionTv.setLeds(ledString.leds);
final Observer observer = new Observer() {
@Override
public void update(Observable o, Object arg) {
mHyperionTv.setLeds(LedFrameFactory.construct(mLedFrameSpec));
ledString.leds = LedFrameFactory.construct(ledString.mLedFrameConfig, ledString.mProcessConfig);
mHyperionTv.setLeds(ledString.leds);
mHyperionTv.repaint();
}
});
};
ledString.mLedFrameConfig.addObserver(observer);
ledString.mProcessConfig.addObserver(observer);
}
private void initialise() {
@ -119,13 +97,15 @@ public class ConfigPanel extends JPanel {
mSpecificationPanel.setPreferredSize(new Dimension(300, 200));
mSpecificationPanel.setLayout(new BoxLayout(mSpecificationPanel, BoxLayout.Y_AXIS));
mConstructionPanel = new LedFramePanel(mLedFrameSpec);
mConstructionPanel = new LedFramePanel(ledString.mLedFrameConfig);
mConstructionPanel.setBorder(BorderFactory.createTitledBorder("Construction"));
mSpecificationPanel.add(mConstructionPanel);
mSpecificationPanel.add(getIntegrationPanel());
mIntegrationPanel = new ImageProcessPanel(ledString.mProcessConfig);
mIntegrationPanel.setBorder(BorderFactory.createTitledBorder("Image Process"));
mSpecificationPanel.add(mIntegrationPanel);
mMiscPanel = new MiscConfigPanel();
mMiscPanel = new MiscConfigPanel(ledString.mMiscConfig);
mMiscPanel.setBorder(BorderFactory.createTitledBorder("Misc"));
mSpecificationPanel.add(mMiscPanel);
@ -137,70 +117,4 @@ public class ConfigPanel extends JPanel {
}
return mSpecificationPanel;
}
private JPanel getIntegrationPanel() {
if (mIntegrationPanel == null) {
mIntegrationPanel = new JPanel();
mIntegrationPanel.setBorder(BorderFactory.createTitledBorder("Image Process"));
mHorizontalDepthLabel = new JLabel("Horizontal depth:");
mHorizontalDepthLabel.setPreferredSize(new Dimension(100, 30));
mHorizontalDepthLabel.setMaximumSize(new Dimension(150, 30));
mIntegrationPanel.add(mHorizontalDepthLabel);
mHorizontalDepthSpinner = new JSpinner(new SpinnerNumberModel(0.05, 0.01, 1.0, 0.01));
mHorizontalDepthSpinner.setPreferredSize(new Dimension(150, 30));
mHorizontalDepthSpinner.setMaximumSize(new Dimension(250, 30));
mHorizontalDepthSpinner.addChangeListener(mChangeListener);
mIntegrationPanel.add(mHorizontalDepthSpinner);
mVerticalDepthLabel = new JLabel("Vertical depth:");
mVerticalDepthLabel.setPreferredSize(new Dimension(100, 30));
mVerticalDepthLabel.setMaximumSize(new Dimension(150, 30));
mIntegrationPanel.add(mVerticalDepthLabel);
mVerticalDepthSpinner = new JSpinner(new SpinnerNumberModel(0.05, 0.01, 1.0, 0.01));
mVerticalDepthSpinner.setPreferredSize(new Dimension(150, 30));
mVerticalDepthSpinner.setMaximumSize(new Dimension(250, 30));
mVerticalDepthSpinner.addChangeListener(mChangeListener);
mIntegrationPanel.add(mVerticalDepthSpinner);
GroupLayout layout = new GroupLayout(mIntegrationPanel);
mIntegrationPanel.setLayout(layout);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthLabel)
.addComponent(mVerticalDepthLabel)
)
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthSpinner)
.addComponent(mVerticalDepthSpinner)
)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthLabel)
.addComponent(mHorizontalDepthSpinner)
)
.addGroup(layout.createParallelGroup()
.addComponent(mVerticalDepthLabel)
.addComponent(mVerticalDepthSpinner)
)
);
}
return mIntegrationPanel;
}
private final ChangeListener mChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
mLedFrameSpec.horizontalDepth = (Double)mHorizontalDepthSpinner.getValue();
mLedFrameSpec.verticalDepth = (Double)mVerticalDepthSpinner.getValue();
mLedFrameSpec.setChanged();
mLedFrameSpec.notifyObservers();
}
};
}

View File

@ -0,0 +1,151 @@
package org.hyperion.config.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;
import javax.swing.GroupLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.hyperion.config.spec.ImageProcessConfig;
public class ImageProcessPanel extends JPanel implements Observer {
private final ImageProcessConfig mProcessConfig;
private JLabel mHorizontalDepthLabel;
private JSpinner mHorizontalDepthSpinner;
private JLabel mVerticalDepthLabel;
private JSpinner mVerticalDepthSpinner;
private JLabel mOverlapLabel;
private JSpinner mOverlapSpinner;
private JLabel mBlackborderDetectorLabel;
private JComboBox<String> mBlackborderDetectorCombo;
public ImageProcessPanel(ImageProcessConfig pProcessConfig) {
super();
mProcessConfig = pProcessConfig;
initialise();
update(mProcessConfig, null);
}
private void initialise() {
mHorizontalDepthLabel = new JLabel("Horizontal depth [%]:");
mHorizontalDepthLabel.setPreferredSize(new Dimension(100, 30));
mHorizontalDepthLabel.setMaximumSize(new Dimension(150, 30));
add(mHorizontalDepthLabel);
mHorizontalDepthSpinner = new JSpinner(new SpinnerNumberModel(5.0, 1.0, 100.0, 1.0));
mHorizontalDepthSpinner.setPreferredSize(new Dimension(150, 30));
mHorizontalDepthSpinner.setMaximumSize(new Dimension(250, 30));
mHorizontalDepthSpinner.addChangeListener(mChangeListener);
add(mHorizontalDepthSpinner);
mVerticalDepthLabel = new JLabel("Vertical depth [%]:");
mVerticalDepthLabel.setPreferredSize(new Dimension(100, 30));
mVerticalDepthLabel.setMaximumSize(new Dimension(150, 30));
add(mVerticalDepthLabel);
mVerticalDepthSpinner = new JSpinner(new SpinnerNumberModel(5.0, 1.0, 100.0, 1.0));
mVerticalDepthSpinner.setPreferredSize(new Dimension(150, 30));
mVerticalDepthSpinner.setMaximumSize(new Dimension(250, 30));
mVerticalDepthSpinner.addChangeListener(mChangeListener);
add(mVerticalDepthSpinner);
mOverlapLabel = new JLabel("Overlap [%]:");
mOverlapLabel.setPreferredSize(new Dimension(100, 30));
mOverlapLabel.setMaximumSize(new Dimension(150, 30));
add(mOverlapLabel);
mOverlapSpinner = new JSpinner(new SpinnerNumberModel(0.0, -100.0, 100.0, 1.0));
mOverlapSpinner.setPreferredSize(new Dimension(150, 30));
mOverlapSpinner.setMaximumSize(new Dimension(250, 30));
mOverlapSpinner.addChangeListener(mChangeListener);
add(mOverlapSpinner);
mBlackborderDetectorLabel = new JLabel("Blackborder Detector:");
add(mBlackborderDetectorLabel);
mBlackborderDetectorCombo = new JComboBox<>(new String[] {"On", "Off"});
mBlackborderDetectorCombo.setSelectedItem("On");
mBlackborderDetectorCombo.setToolTipText("Enables or disables the blackborder detection and removal");
mBlackborderDetectorCombo.addActionListener(mActionListener);
add(mBlackborderDetectorCombo);
GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateGaps(true);
setLayout(layout);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthLabel)
.addComponent(mVerticalDepthLabel)
.addComponent(mOverlapLabel)
.addComponent(mBlackborderDetectorLabel)
)
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthSpinner)
.addComponent(mVerticalDepthSpinner)
.addComponent(mOverlapSpinner)
.addComponent(mBlackborderDetectorCombo)
)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(mHorizontalDepthLabel)
.addComponent(mHorizontalDepthSpinner)
)
.addGroup(layout.createParallelGroup()
.addComponent(mVerticalDepthLabel)
.addComponent(mVerticalDepthSpinner)
)
.addGroup(layout.createParallelGroup()
.addComponent(mOverlapLabel)
.addComponent(mOverlapSpinner)
)
.addGroup(layout.createParallelGroup()
.addComponent(mBlackborderDetectorLabel)
.addComponent(mBlackborderDetectorCombo)
)
);
}
@Override
public void update(Observable pObs, Object pArg) {
if (pObs == mProcessConfig && pArg != this) {
mHorizontalDepthSpinner.setValue(mProcessConfig.horizontalDepth * 100.0);
mVerticalDepthSpinner.setValue(mProcessConfig.verticalDepth * 100.0);
mOverlapSpinner.setValue(mProcessConfig.overlapFraction * 100.0);
}
}
private final ActionListener mActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mProcessConfig.blackBorderRemoval = (mBlackborderDetectorCombo.getSelectedItem() == "On");
}
};
private final ChangeListener mChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
mProcessConfig.horizontalDepth = ((Double)mHorizontalDepthSpinner.getValue())/100.0;
mProcessConfig.verticalDepth = ((Double)mVerticalDepthSpinner.getValue())/100.0;
mProcessConfig.overlapFraction = ((Double)mOverlapSpinner.getValue())/100.0;
mProcessConfig.setChanged();
mProcessConfig.notifyObservers(this);
}
};
}

View File

@ -26,6 +26,7 @@ import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import javax.swing.SwingWorker;
import org.hyperion.config.spec.Led;
@ -88,7 +89,7 @@ public class JHyperionTv extends Component {
}
}
private JPopupMenu getPopupMenu() {
private synchronized JPopupMenu getPopupMenu() {
if (mPopupMenu == null) {
mPopupMenu = new JPopupMenu();
mPopupMenu.add(mLoadAction);
@ -137,7 +138,12 @@ public class JHyperionTv extends Component {
public JHyperionTv() {
// Pre-cache the popup menu
getPopupMenu();
new SwingWorker<Object, Object>() {
@Override
protected Object doInBackground() throws Exception {
return getPopupMenu();
}
}.execute();
addMouseMotionListener(new MouseMotionListener() {
@Override

View File

@ -9,9 +9,12 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import org.hyperion.config.spec.BootSequence;
import org.hyperion.config.spec.MiscConfig;
public class MiscConfigPanel extends JPanel {
private final MiscConfig mMiscConfig;
private JLabel mMenuLabel;
private JComboBox<String> mMenuCombo;
private JLabel mVideoLabel;
@ -21,14 +24,14 @@ public class MiscConfigPanel extends JPanel {
private JLabel mAudioLabel;
private JComboBox<String> mAudioCombo;
private JLabel mBlackborderDetectorLabel;
private JComboBox<String> mBlackborderDetectorCombo;
private JLabel mBootSequenceLabel;
private JComboBox<BootSequence> mBootSequenceCombo;
public MiscConfigPanel() {
public MiscConfigPanel(MiscConfig pMiscConfig) {
super();
mMiscConfig = pMiscConfig;
initialise();
}
@ -73,14 +76,6 @@ public class MiscConfigPanel extends JPanel {
mAudioCombo.addActionListener(mActionListener);
add(mAudioCombo);
mBlackborderDetectorLabel = new JLabel("Blackborder Detector:");
add(mBlackborderDetectorLabel);
mBlackborderDetectorCombo = new JComboBox<>(new String[] {"On", "Off"});
mBlackborderDetectorCombo.setSelectedItem("On");
mBlackborderDetectorCombo.setToolTipText("Enables or disables the blackborder detection and removal");
add(mBlackborderDetectorCombo);
mBootSequenceLabel = new JLabel("Boot Sequence:");
add(mBootSequenceLabel);
@ -95,7 +90,6 @@ public class MiscConfigPanel extends JPanel {
.addComponent(mVideoLabel)
.addComponent(mPictureLabel)
.addComponent(mAudioLabel)
.addComponent(mBlackborderDetectorLabel)
.addComponent(mBootSequenceLabel)
)
.addGroup(layout.createParallelGroup()
@ -103,7 +97,6 @@ public class MiscConfigPanel extends JPanel {
.addComponent(mVideoCombo)
.addComponent(mPictureCombo)
.addComponent(mAudioCombo)
.addComponent(mBlackborderDetectorCombo)
.addComponent(mBootSequenceCombo)
));
layout.setVerticalGroup(layout.createSequentialGroup()
@ -123,10 +116,6 @@ public class MiscConfigPanel extends JPanel {
.addComponent(mAudioLabel)
.addComponent(mAudioCombo)
)
.addGroup(layout.createParallelGroup()
.addComponent(mBlackborderDetectorLabel)
.addComponent(mBlackborderDetectorCombo)
)
.addGroup(layout.createParallelGroup()
.addComponent(mBootSequenceLabel)
.addComponent(mBootSequenceCombo)
@ -136,7 +125,12 @@ public class MiscConfigPanel extends JPanel {
private final ActionListener mActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mMiscConfig.mBootSequence = (BootSequence)mBootSequenceCombo.getSelectedItem();
mMiscConfig.mMenuOn = (mMenuCombo.getSelectedItem() == "On");
mMiscConfig.mVideoOn = (mVideoCombo.getSelectedItem() == "On");
mMiscConfig.mPictureOn = (mPictureCombo.getSelectedItem() == "On");
mMiscConfig.mAudioOn = (mAudioCombo.getSelectedItem() == "On");
}
};
}

View File

@ -0,0 +1,21 @@
package org.hyperion.config.spec;
import java.util.Observable;
public class ImageProcessConfig extends Observable {
/** The 'integration depth' of the leds along the horizontal axis of the tv */
public double horizontalDepth = 0.05;
/** The 'integration depth' of the leds along the vertical axis of the tv */
public double verticalDepth = 0.05;
/** The fraction of overlap from one to another led */
public double overlapFraction = 0.0;
public boolean blackBorderRemoval = true;
@Override
public void setChanged() {
super.setChanged();
}
}

View File

@ -16,42 +16,39 @@ public class LedFrameConstruction extends Observable {
}
/** True if the leds are organised clockwise else false (counter clockwise) */
public boolean clockwiseDirection;
public boolean clockwiseDirection = true;
/** True if the top left corner has a led else false */
public boolean topLeftCorner;
public boolean topLeftCorner = true;
/** True if the top right corner has a led else false */
public boolean topRightCorner;
public boolean topRightCorner = true;
/** True if the bottom left corner has a led else false */
public boolean bottomLeftCorner;
public boolean bottomLeftCorner = true;
/** True if the bottom right corner has a led else false */
public boolean bottomRightCorner;
public boolean bottomRightCorner = true;
/** The number of leds between the top-left corner and the top-right corner of the screen
(excluding the corner leds) */
public int topLedCnt;
public int topLedCnt = 16;
/** The number of leds between the bottom-left corner and the bottom-right corner of the screen
(excluding the corner leds) */
public int bottomLedCnt;
public int bottomLedCnt = 16;
/** The number of leds between the top-left corner and the bottom-left corner of the screen
(excluding the corner leds) */
public int leftLedCnt;
public int leftLedCnt = 7;
/** The number of leds between the top-right corner and the bottom-right corner of the screen
(excluding the corner leds) */
public int rightLedCnt;
public int rightLedCnt = 7;
/** The offset (in leds) of the starting led counted clockwise from the top-left corner */
public int firstLedOffset;
/** The 'integration depth' of the leds along the horizontal axis of the tv */
public double horizontalDepth = 0.05;
/** The 'integration depth' of the leds along the vertical axis of the tv */
public double verticalDepth = 0.05;
/** The fraction of overlap from one to another led */
public double overlapFraction = 0.0;
public int firstLedOffset = -16;
/**
* Returns the total number of leds
*
* @return The total number of leds
*/
public int getLedCount() {
int cornerLedCnt = 0;
if (topLeftCorner) ++cornerLedCnt;

View File

@ -4,18 +4,20 @@ import java.util.Locale;
public class MiscConfig {
BootSequence mBootSequence = BootSequence.rainbow;
int mBootSequenceLength_ms = 3000;
public BootSequence mBootSequence = BootSequence.rainbow;
public int mBootSequenceLength_ms = 3000;
boolean mBlackborderDetector = true;
int mFrameGrabberWidth = 64;
int mFrameGrabberHeight = 64;
int mFrameGrabberInterval_ms = 100;
public int mFrameGrabberWidth = 64;
public int mFrameGrabberHeight = 64;
public int mFrameGrabberInterval_ms = 100;
boolean mXbmcChecker = true;
String mXbmcAddress = "127.0.0.1";
int mXbmcTcpPort = 9090;
public boolean mXbmcChecker = true;
public String mXbmcAddress = "127.0.0.1";
public int mXbmcTcpPort = 9090;
public boolean mVideoOn = true;
public boolean mMenuOn = false;
public boolean mPictureOn = false;
public boolean mAudioOn = false;
public String toJsonString() {
StringBuffer strBuf = new StringBuffer();