Java Reference
In-Depth Information
We have seen the stored images and would like to take a new picture
and upload it to the website with the location information. First, we get
our current location using JSR-179:
LocationProvider lp = getLocationProvider();
Location loc = lp.getLastKnownLocation();
// TODO: check not null, check timestamp etc..
QualifiedCoordinates qc = loc.getQualifiedCoordinates();
double lat = qc.getLatitude(),
double lon = qc.getLongitude(),
Next, we get a map of the current location from a geo site using
JSR-172 Web Services, which retrieves the map as an SVG image. We use
the NetBeans SVGPlayer utility class, which can be used as a component
in NetBeans Visual Designer and encapsulates SVGAnimator :
Display display = getMIDletDisplay();
InputStream in = getMapFromServer(); // get input stream to SVG map, using
// Web Services
SVGImage svgMap = (SVGImage)SVGImage.createImage(in, null);
svgPlayer = new SVGPlayer(svgMap, getDisplay());
svgPlayer.setTitle("Current location map:"); // set title
SVGElement labelElement = getSVGMapLabelElement(svgPlayer);
// Set the SVG element trait
labelElement.setTrait("#text", "Picture taken here!");
We can then take a picture using JSR-234 AMMS, which provides
enhanced access for camera-specific controls, such as brightness, con-
trast, flash lights, lighting modes and zooming. These enable us to have
fine-grained control over the camera and the resulting picture. The fol-
lowing example demonstrates some of the controls that JSR-234 AMMS
adds on top of JSR-135 MMAPI:
player = Manager.createPlayer("capture://video");
snapshotControl = (SnapshotControl) player.getControl
flashControl = (FlashControl) player.getControl
zoomControl = (ZoomControl) player.getControl
focusControl = (FocusControl) player.getControl
exposureControl = (ExposureControl) player.getControl
imageFormatControl = (ImageFormatControl) player.getControl
Search WWH ::

Custom Search