/** * Method that receives candidate markers. Here, they are filtered for the markers we want and * partnered with the entities we'll show. * * @param markerCandidates The list containing all detected markers. */ protected void updateList(ArrayList<Marker> markerCandidates) { synchronized (synLock) { updatedData = true; if (ONLY_HOMOGRAPHY) { for (HomographyListener listener : listeners) { listener.receiveHomographies(markerCandidates); } } // Else case means we'll be rendering it, // so we filter the detected markers against the entity pairs we // want: else { // Remove old list: detectedTrackables.clear(); // Now go through all trackables: for (Entity tracking : allTrackables) { // Check if we want to render it: if (!tracking.getVisibility()) continue; for (Marker mark : markerCandidates) // Add to rendering: if (mark.getID() == tracking.getID()) { detectedTrackables.add( new Trackable(mark.getID(), mark.getTranslation(), tracking.getFloatBuffer())); // Simply continue with next entity if we don't // want multiple renders: if (!ALLOW_DUPLICATE_MARKERS) break; } } } } }
private Boolean updateMarkers(ReadableArray markerArray) { try { // First clear all markers from the map for (Marker marker : mapMarkers) { marker.remove(); } mapMarkers.clear(); markerLookup.clear(); // All markers to map for (int i = 0; i < markerArray.size(); i++) { ReadableMap markerJson = markerArray.getMap(i); if (markerJson.hasKey("coordinates")) { Marker marker = map.addMarker(createMarker(markerJson)); if (markerJson.hasKey("id")) { // As we have to lookup it either way, switch it around markerLookup.put(marker.getId(), markerJson.getString("id")); markerLookup.put(markerJson.getString("id"), marker.getId().replace("m", "")); } mapMarkers.add(marker); } else break; } return true; } catch (Exception e) { e.printStackTrace(); return false; } }
@Override protected void onDraw(Canvas canvas) { if (canvas == null) return; if (drawing.compareAndSet(false, true)) { List<Marker> collection = ARData.getMarkers(); cache.clear(); for (Marker m : collection) { m.update(canvas, 0, 0); if (m.isOnRadar()) cache.add(m); cache.add(m); } collection = cache; if (AugmentedActivity.useCollisionDetection) adjustForCollisions(canvas, collection); ListIterator<Marker> iter = collection.listIterator(collection.size()); while (iter.hasPrevious()) { Marker marker = iter.previous(); marker.draw(canvas); } if (AugmentedActivity.showRadar) radar.draw(canvas); drawing.set(false); } }
public void mousePressed(MouseEvent e) { this.mousePoint = e.getPoint(); Object topObject = null; PickedObjectList pickedObjects = this.wwd.getObjectsAtCurrentPosition(); if (pickedObjects != null) topObject = pickedObjects.getTopObject(); if (topObject instanceof ControlPointMarker) { this.activeControlPoint = (ControlPointMarker) topObject; this.activeAction = this.activeControlPoint.getType(); setShowAnnotation(true); updateAnnotation(this.activeControlPoint.getPosition()); // update controlPointIndex; int i = 0; for (Marker controlPoint : this.controlPoints) { if (controlPoint.equals(topObject)) break; i++; } this.activeControlPointIndex = i; e.consume(); } else if (topObject == this.getPolygon()) { this.activeAction = MOVE_POLYGON_ACTION; // set the shape to be the "active control point" this.activeControlPointIndex = -1; setShowAnnotation(true); updateAnnotation(this.polygon.getReferencePosition()); e.consume(); } }
@Override public String getToolTipText(int x, int y) { if (isMarkerHighlightEnabled()) { int lineHeight = textArea.getPainter().getFontMetrics().getHeight(); if (lineHeight == 0) return null; int line = y / lineHeight; int start = textArea.getScreenLineStartOffset(line); int end = textArea.getScreenLineEndOffset(line); if (start == -1 || end == -1) return null; Buffer buffer = (Buffer) textArea.getBuffer(); Marker marker = buffer.getMarkerInRange(start, end); if (marker != null) { char shortcut = marker.getShortcut(); if (shortcut == '\0') return jEdit.getProperty("view.gutter.marker.no-name"); else { String[] args = {String.valueOf(shortcut)}; return jEdit.getProperty("view.gutter.marker", args); } } } return null; }
public void draw() { if (!bEnableDrawing) return; for (Marker marker : markers) { marker.draw(map); } }
@Override public void updateLocationMarker(Location location) { if (locationChangedListener != null) { currentUserLocation = location; locationChangedListener.onLocationChanged(location); } // Update clickable area LatLng userPosition = getUserLocation(location); if (userPositionClickArea == null) { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.position(userPosition); markerOptions.anchor(0.4f, 0.4f); // strange google maps bug markerOptions.icon(BitmapDescriptorFactory.fromBitmap(clickableBitmap)); userPositionClickArea = googleMap.addMarker(markerOptions); } else { userPositionClickArea.setPosition(userPosition); } if (userPositionClickArea2 == null) { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.position(userPosition); markerOptions.anchor(0.6f, 0.6f); // strange google maps bug markerOptions.icon(BitmapDescriptorFactory.fromBitmap(clickableBitmap)); userPositionClickArea2 = googleMap.addMarker(markerOptions); } else { userPositionClickArea2.setPosition(userPosition); } }
public void goToNextMarker(boolean select) { java.util.List<Marker> markers = buffer.getMarkers(); if (markers.isEmpty()) { getToolkit().beep(); return; } Marker marker = null; int caret = textArea.getCaretPosition(); for (int i = 0; i < markers.size(); i++) { Marker _marker = markers.get(i); if (_marker.getPosition() > caret) { marker = _marker; break; } } if (marker == null) marker = markers.get(0); if (select) textArea.extendSelection(caret, marker.getPosition()); else if (!textArea.isMultipleSelectionEnabled()) textArea.selectNone(); textArea.moveCaretPosition(marker.getPosition()); }
public void clear() { for (Marker m : trail) { m.setVisible(false); m.flagForRemoval(); } trail.clear(); counter = 0; }
public void addMarker(char key, Integer offset) { Marker marker = this.get(key); if (marker == null) { this.put(key, new Marker(key, offset)); return; } marker.addOffsetToMarker(offset); }
public void setMarker(String aName, BlockPosition aPos) { Marker lMarker = getMarker(aName); if (lMarker == null) { lMarker = new Marker(); lMarker.name = aName; addRecord(lMarker); } lMarker.pos = aPos.clone(); }
public void addMarker(ReadableMap config) { MarkerOptions options = createMarker(config); Marker marker = map.addMarker(options); mapMarkers.add(marker); if (config.hasKey("id")) { // As we have to lookup it either way, switch it around markerLookup.put(marker.getId(), config.getString("id")); markerLookup.put(config.getString("id"), marker.getId().replace("m", "")); } }
@Override public float gl(int sample, int allele1, int allele2) { if (allele1 < 0 || allele1 >= marker.nAlleles()) { throw new IndexOutOfBoundsException(String.valueOf(allele1)); } if (allele2 < 0 || allele2 >= marker.nAlleles()) { throw new IndexOutOfBoundsException(String.valueOf(allele2)); } boolean matches = (allele1 == allele1(sample) && allele2 == allele2(sample)); return matches ? 1.0f : 0.0f; }
public void swapMarkerAndCaret(char shortcut) { Marker marker = buffer.getMarker(shortcut); if (marker == null) { getToolkit().beep(); return; } int caret = textArea.getCaretPosition(); textArea.setCaretPosition(marker.getPosition()); buffer.addMarker(shortcut, caret); }
public void setFloatOffset(int x) { mOffset = x; int centerDiffX = mMarker.getMeasuredWidth() / 2; int offset = (x - centerDiffX); mMarker.offsetLeftAndRight(offset - mMarker.getLeft()); // Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate // the proper area. // We should calc the proper invalidate Rect but this will be for now... if (!SeekBarCompat.isHardwareAccelerated(this)) { invalidate(); } }
public void process(Context c, Sentence s) { // we assume markers occur only at the beginning of clauses // TODO is this heuristic language-specific? Intervals markerInts = new Intervals(); for (Interval clause : s.get(Features.CLAUSES)) for (Marker m : markers) if (testMarker(s, clause, m)) { markerInts.add(clause.low(), clause.low() + m.length()).set(Features.MARKER_TYPE, m.type); break; } s.set(Features.DISCOURSE_MARKERS, markerInts); }
private boolean onLocationMarkerTap(Marker marker) { if (userPositionClickArea == null) return false; if (userPositionClickArea2 == null) return false; if (marker.getId().equals(userPositionClickArea.getId()) || marker.getId().equals(userPositionClickArea2.getId())) { if (locationMarkerTapListener != null) locationMarkerTapListener.onMarkerTapped(); return true; } return false; }
@SuppressLint("InflateParams") @Override public View getInfoContents(Marker marker) { if (mPopup == null) { mPopup = mInflater.inflate(R.layout.single_host_infowindow, null); } TextView titleView = (TextView) mPopup.findViewById(R.id.title); titleView.setText(marker.getTitle()); TextView snippetView = (TextView) mPopup.findViewById(R.id.snippet); snippetView.setText(Html.fromHtml(marker.getSnippet())); return (mPopup); }
public void goToMarker(char shortcut, boolean select) { Marker marker = buffer.getMarker(shortcut); if (marker == null) { getToolkit().beep(); return; } int pos = marker.getPosition(); if (select) textArea.extendSelection(textArea.getCaretPosition(), pos); else if (!textArea.isMultipleSelectionEnabled()) textArea.selectNone(); textArea.moveCaretPosition(pos); }
public BasicMarkerTest() { factory = new BasicMarkerFactory(); blue = factory.getMarker(BLUE_STR); red = factory.getMarker(RED_STR); green = factory.getMarker(GREEN_STR); comp = factory.getMarker(COMP_STR); comp.add(blue); multiComp = factory.getMarker(MULTI_COMP_STR); multiComp.add(green); multiComp.add(comp); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); latitude = getIntent().getDoubleExtra("Latitude", 0); lognitude = getIntent().getDoubleExtra("Lognitude", 0); Marker.readMarkers(); MarkerDataAdapter adapter = new MarkerDataAdapter(this, Marker.getList()); mylist = (ListView) findViewById(R.id.listView); // adapter = new ArrayAdapter<Product>(this,android.R.layout.simple_list_item_1,itemList);*/ mylist.setAdapter(adapter); }
/** * Paint the fall-back marker * * @param g the graphics device * @param context the way-point * @param converter the converter * @param zoom the zoom level * @param gBounds the graphics bounds * @param calculateArea if the area representing the marker should be calculated, if <code>false * </code> is given here the return value is ignored and should be <code>null</code> * @return the area that represents the marker */ protected Area paintFallback( Graphics2D g, T context, PixelConverter converter, int zoom, Rectangle gBounds, boolean calculateArea) { Marker<? super T> marker = getFallbackMarker(context); marker.paint(g, converter, zoom, context, gBounds); if (calculateArea) { return marker.getArea(zoom); } else { return null; } }
/** Query all genomic regions that intersect 'marker' */ @Override public Markers query(Marker marker) { Markers markers = new Markers(); for (Marker m : this) { if (m.intersects(marker)) { markers.add(m); Markers subMarkers = m.query(marker); if (subMarkers != null) markers.add(subMarkers); } } return markers; }
@Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.BLACK); path.reset(); for (int i = 0; i < markers.size(); i++) { Marker marker = markers.get(i); if (i == 0) path.moveTo(marker.x, marker.y); path.lineTo(marker.x, marker.y); marker.onDraw(canvas, paint); } paint.setColor(Color.WHITE); canvas.drawPath(path, paint); super.onDraw(canvas); }
/** * ******************************************************************************* addMarker * * <p>This method is responsible for adding crumbs to the handler and determining when crumbs * should become invisible. Right now, crumbs are removed once there are more than 20 markers in * the handler. Crumbs are removed according to when they were placed on the manifold by the user. * ******************************************************************************* */ public void addMarker(ManifoldPosition mp) { ManifoldPosition pos = new ManifoldPosition(mp); Vector vec = new Vector(pos.getDirectionForward()); vec.scale(-.25); pos.move(vec); Marker m = new Marker(pos, crumb, Marker.MarkerType.FIXED); trail.add(m); markers.addMarker(m); counter++; int numMarkers = trail.size() - 1; if (numMarkers >= 5) { Marker toRemove = trail.poll(); toRemove.flagForRemoval(); } }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { measureChildren(widthMeasureSpec, heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSie = mMarker.getMeasuredHeight(); setMeasuredDimension(widthSize, heightSie); }
/** Parse a line from a serialized file */ @SuppressWarnings("unchecked") @Override public void serializeParse(MarkerSerializer markerSerializer) { super.serializeParse(markerSerializer); Markers markers = markerSerializer.getNextFieldMarkers(); for (Marker m : markers) add((T) m); }
/** * Returns true if {@code container} contains {@code test}, false otherwise. * * <p>Fields for which {@code set} has no value ({@link Marker#valueFor(FieldPartitioner)} returns * null) are treated as wildcards and always match. * * <p>All fields in the {@link PartitionStrategy} are compared. * * @param container a {@code Marker} that defines a set of partitions * @param test a {@code Marker} that may be a subset of {@code container} * @return {@code true} if the partitions in {@code test} are a subset of {@code container}, * {@code false} otherwise */ @SuppressWarnings("unchecked") public boolean contains(Marker container, Marker test) { for (FieldPartitioner field : strategy.getFieldPartitioners()) { Object containerValue = container.valueFor(field); if (containerValue != null) { Object testValue = test.valueFor(field); if (testValue == null || field.compare(containerValue, testValue) != 0) { return false; } } /* * Rather than returning true if containerValue is null, this treats * null as a wildcard. Everything matches null, so all non-null fields * will be checked. */ } return true; }
private Boolean zoomOnMarkers() { try { int padding = 150; LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (Marker marker : mapMarkers) { builder.include(marker.getPosition()); } LatLngBounds bounds = builder.build(); CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding); map.animateCamera(cu); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
private List<Marker> createMarkersFromEvents(List<Event> events) { List<Marker> markers = new ArrayList<Marker>(events.size()); for (Event event : events) { Location start = getLocationByType(event, LocationType.START); if (start != null) { Marker marker = new Marker( new LatLng(start.getPoint().getCoordinate().y, start.getPoint().getCoordinate().x)); marker.setTitle(event.getName()); marker.setData(event); if (event.getPublicEvent() != null && event.getPublicEvent().booleanValue()) { marker.setIcon("http://maps.google.com/mapfiles/ms/micons/green-dot.png"); } markers.add(marker); } } return markers; }