Add some docs
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import app.AppModule;
|
import app.AppModule;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import presenters.MainPresenter;
|
|
||||||
import presenters.NavPresenter;
|
|
||||||
import ui.implementation.components.nav.NavBar;
|
import ui.implementation.components.nav.NavBar;
|
||||||
import ui.implementation.views.MainView;
|
import ui.implementation.views.MainView;
|
||||||
import ui.interfaces.IMainView;
|
import ui.interfaces.IMainView;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import ui.interfaces.IMainView;
|
|||||||
import ui.interfaces.INavBar;
|
import ui.interfaces.INavBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gathers some configurations in order to set the dependency injection container up
|
||||||
* @author Laurent Crema
|
* @author Laurent Crema
|
||||||
*/
|
*/
|
||||||
public class AppModule extends AbstractModule {
|
public class AppModule extends AbstractModule {
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package app;
|
package app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides some endpoints to browse between views
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public interface INavigator {
|
public interface INavigator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays Fourier view
|
||||||
|
*/
|
||||||
void showFourier();
|
void showFourier();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import ui.implementation.views.DoubleMatrix;
|
import ui.implementation.views.DoubleMatrix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concrete implement of the INavigator interface.
|
||||||
|
* Implements abstract endpoints to displays views in a Swing way
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class SwingNavigator implements INavigator {
|
public class SwingNavigator implements INavigator {
|
||||||
|
|
||||||
private final Provider<DoubleMatrix> doubleMatrixProvider;
|
private final Provider<DoubleMatrix> doubleMatrixProvider;
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import domain.events.ImageChangedEvent;
|
|||||||
import domain.events.ModeChangedEvent;
|
import domain.events.ModeChangedEvent;
|
||||||
import domain.image.Image;
|
import domain.image.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the global state of the app
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AppState extends State {
|
public class AppState extends State {
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ package app.state;
|
|||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents any states that could ever exist.
|
||||||
|
* In order to notify the caller about any change made to internal properties of a children state, the caller
|
||||||
|
* must register itself
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public abstract class State {
|
public abstract class State {
|
||||||
|
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
@@ -10,6 +16,10 @@ public abstract class State {
|
|||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the caller so it can be notifed from changes within the state
|
||||||
|
* @param obj the caller itself
|
||||||
|
*/
|
||||||
public void register(Object obj) {
|
public void register(Object obj) {
|
||||||
eventBus.register(obj);
|
eventBus.register(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package domain.common;
|
package domain.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides some pseudo-types to identify a drawing mode
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
DISABLED,
|
DISABLED,
|
||||||
DRAW_PIXEL,
|
DRAW_PIXEL,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import infrastructure.image.io.ImageSaver;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Represents a matrix of gray-scaled pixels
|
||||||
* @author Jean-Marc Wagner, Laurent Crema
|
* @author Jean-Marc Wagner, Laurent Crema
|
||||||
*/
|
*/
|
||||||
public class GrayScaleMatrix {
|
public class GrayScaleMatrix {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package domain.image.processing.complex;
|
package domain.image.processing.complex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class ComplexMatrix
|
public class ComplexMatrix
|
||||||
{
|
{
|
||||||
private Complexe m[][];
|
private Complexe m[][];
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package domain.image.processing.complex;
|
package domain.image.processing.complex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class Complexe
|
public class Complexe
|
||||||
{
|
{
|
||||||
private double partieReelle;
|
private double partieReelle;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package domain.image.processing.fourier;
|
|||||||
|
|
||||||
import domain.image.processing.complex.ComplexMatrix;
|
import domain.image.processing.complex.ComplexMatrix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class Fourier
|
public class Fourier
|
||||||
{
|
{
|
||||||
public static ComplexMatrix Fourier2D(double f[][])
|
public static ComplexMatrix Fourier2D(double f[][])
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package domain.image.processing.histogram;
|
|||||||
import domain.image.GrayScaleMatrix;
|
import domain.image.GrayScaleMatrix;
|
||||||
import domain.image.Image;
|
import domain.image.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class Histogramme {
|
public class Histogramme {
|
||||||
public static int[] Histogramme256(GrayScaleMatrix mat) {
|
public static int[] Histogramme256(GrayScaleMatrix mat) {
|
||||||
int M = mat.getHeight();
|
int M = mat.getHeight();
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import java.io.IOException;
|
|||||||
import domain.image.Image;
|
import domain.image.Image;
|
||||||
import domain.image.Pixel;
|
import domain.image.Pixel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class ImageLoader {
|
public class ImageLoader {
|
||||||
|
|
||||||
public static Image loadImage(File f) throws IOException {
|
public static Image loadImage(File f) throws IOException {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import domain.image.Image;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class ImageSaver {
|
public class ImageSaver {
|
||||||
|
|
||||||
public static void saveImage(Image image) throws IOException {
|
public static void saveImage(Image image) throws IOException {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import domain.image.Pixel;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public final class ImageMapper {
|
public final class ImageMapper {
|
||||||
|
|
||||||
public static BufferedImage toBufferedImage(Image image) {
|
public static BufferedImage toBufferedImage(Image image) {
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import infrastructure.image.io.ImageSaver;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class ImageService {
|
public class ImageService {
|
||||||
|
|
||||||
private final AppState appState;
|
private final AppState appState;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import app.state.AppState;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import domain.common.Mode;
|
import domain.common.Mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class ModeService {
|
public class ModeService {
|
||||||
|
|
||||||
private final AppState appState;
|
private final AppState appState;
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class ImagePanel extends JPanel {
|
public class ImagePanel extends JPanel {
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
private double scale;
|
private double scale;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package ui.implementation.components.intent;
|
package ui.implementation.components.intent;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema
|
||||||
|
*/
|
||||||
public class FileChooser extends JFileChooser {
|
public class FileChooser extends JFileChooser {
|
||||||
|
|
||||||
public FileChooser(String initialLocation) {
|
public FileChooser(String initialLocation) {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package ui.implementation.components.nav;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class Menu extends JMenu {
|
public class Menu extends JMenu {
|
||||||
|
|
||||||
public Menu(String title, JMenuItem... items)
|
public Menu(String title, JMenuItem... items)
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import javax.swing.*;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class MenuItem extends JMenuItem {
|
public class MenuItem extends JMenuItem {
|
||||||
|
|
||||||
public MenuItem(String title, ActionListener listener) {
|
public MenuItem(String title, ActionListener listener) {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package ui.implementation.dialogs;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class GreyScaleImageCreatorDialog extends ImageCreatorDialog
|
public class GreyScaleImageCreatorDialog extends ImageCreatorDialog
|
||||||
{
|
{
|
||||||
private JSlider slider;
|
private JSlider slider;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package ui.implementation.dialogs;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class GreyScalePicker extends javax.swing.JDialog
|
public class GreyScalePicker extends javax.swing.JDialog
|
||||||
{
|
{
|
||||||
private int couleur;
|
private int couleur;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public abstract class ImageCreatorDialog extends JDialog
|
public abstract class ImageCreatorDialog extends JDialog
|
||||||
{
|
{
|
||||||
protected Color color;
|
protected Color color;
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package ui.implementation.dialogs;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Laurent Crema, Jean-Marc Wagner
|
||||||
|
*/
|
||||||
public class RGBImageCreatorDialog extends ImageCreatorDialog
|
public class RGBImageCreatorDialog extends ImageCreatorDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user