JMU CS349 - Developing Multimedia
Gallery Help Policies Solutions Study-Aids Syllabus Tools
Programming Assignment 5


1 Purpose

The primary purpose of this assignment is to help you review (and demonstrate that you have acquired) the knowledge and skills required to create a program that uses static visual content (both sampled and described).

2 Background

The (fictitious) company EnhancedRealty has now asked you to build an applet/application for HomeBase that will allow users to load and display Property objects on a map.

3 Documents

EnhancedRealty uses a heavyweight process (as opposed to an agile process) so they have created a fairly detailed set of specifications. They are described in the following document:

4 Resources

EnhancedRealty has provided you with the following resources:

5 Submission

There is a two part submission process for this assignment.
  1. You must submit (using Gradescope) a .zip file containing all of the code necessary to build your application. Gradescope will only be checking to ensure that your code complies with the course style guide. Hence, you may only submit to Gradescope five times. If you can't get your code to comply with the course style guide within five submissions, you will receive a grade of 0 on the assignment.
  2. You must also submit (using Canvas) an executable .jar file named StaticMapApplication.jar (that must NOT contain any of the classes in multimedia2.jar ).

6 Grading

You will receive one of four grades on this assignment -- 100, 75, 50, or 0. You will receive a grade of 100 if your code is essentially correct (i.e., a limited number of system tests do not cause any failures). You will receive a grade of 75 if you appear to have devoted significant effort to the assignment but your code has small defects. You will receive a grade of 50 if you devoted a reasonable amount of effort to the assignment but your code has major defects. You will receive a grade of 0 otherwise and/or if the code you submit to Gradescope code contains any style defects.

Gradescope will assign a maximum grade of 25 (based solely on style). Points will then be awarded manually based on the criteria discussed in the previous paragraph.

7 Help

You might find the following tips/hints helpful.

7.1 Getting Started

You might want to start by making sure you understand the following LogoApplication class:
package homebase;

//Java libraries
import java.io.*;
import javax.swing.*;

//Multimedia libraries
import app.*;

// Application libraries
import gui.*;
import realestate.*;

/**
 * An application that displays a logo.
 * 
 * @author Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class LogoApplication extends HomeBaseApplication
{
  private LogoPanel logoPanel;
  
  /**
   * Explicit value constructor.
   * 
   * @param args   The command line arguments
   */
  public LogoApplication(final String[] args) throws IOException
  {
    super(args);
    logoPanel = new LogoPanel(WIDTH, HEIGHT-60);
  }
    
  /**
   * Get the GUI component that will be used to display the logo.
   * 
   * @return The LogoPanel
   */
  @Override
  protected JComponent getGUIComponent()
  {
    return logoPanel.getView();
  }
  
  /**
   * Get the PropertyObserver to inform of changes.
   * 
   * @return null
   */
  @Override
  protected PropertyObserver getPropertyObserver()
  {
    return null;
  }
  
  /**
   * Construct and invoke  (in the event dispatch thread) 
   * an instance of this JApplication.
   * 
   * @param args The command line arguments
   */
  public static void main(final String[] args) throws IOException
  {
    JApplication app = new LogoApplication(args);
    invokeInEventDispatchThread(app);
  }
}
    

It makes use of the following LogoBoard class that is a Visualization that adds a single piece of visual.statik.sampled.Content (containing the logo) to itself.

package gui;

// Java libraries
import java.io.*;

// Multimedia libraries
import io.*;
import visual.*;
import visual.statik.sampled.*;

// Application libraries
import resources.Marker;


/**
 * A Visualization that can be used to display a logo.
 * 
 * @author Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class LogoPanel extends Visualization
{
  private ResourceFinder jarFinder;
  
  /**
   * Explicit Value Constructor.
   * 
   * @param width The width of this component (in pixels)
   * @param height The height of this component (in pixels)
   * @throws IOException if something goes wrong
   */
  public LogoPanel(final int width, final int height) throws IOException
  {
    super();
    
    jarFinder = ResourceFinder.createInstance(new Marker());

    VisualizationView view = getView();
    view.setBounds(0, 0, width, height);
    view.setSize(width, height);

    ContentFactory contentFactory = new ContentFactory(jarFinder);
    Content logo = contentFactory.createContent("logoHomeBase.png", 4);
    logo.setLocation(0, 0);
    add(logo);
  }

}

7.2 Graying-Out the Watermark

As mentioned in the specifications, the .jar file must contain the HomeBase logo in "color", it must not contain a gray-version.

You can gray-out the "color" version using a BufferedImageOp.

7.3 Polygons

The easiest way to create a Shape object from geographic boundary files is to use a Path2D.Float or Path2D.Double object.

7.4 Reading Icons

The easiest way to read individual icons is to use a visual.statik.sampled.ImageFactory object.

Copyright 2024