コード例 #1
0
ファイル: DataHandler.java プロジェクト: GyuminLee/Android
 public void onLocationChanged(Location location) {
   updateDistances(location);
   sortMarkerList();
   for (Marker ma : markerList) {
     ma.update(location);
   }
 }
コード例 #2
0
ファイル: RadarPoints.java プロジェクト: januar/KulinARMedan
  public void paint(PaintScreen dw) {
    /** radius is in KM. */
    range = view.getRadius() * 1000;
    /** Draw the radar */
    dw.setFill(true);
    dw.setColor(radarColor);
    dw.paintCircle(originX + RADIUS, originY + RADIUS, RADIUS);

    /** put the markers in it */
    float scale = range / RADIUS;

    DataHandler jLayer = view.getDataHandler();

    for (int i = 0; i < jLayer.getMarkerCount(); i++) {
      Marker pm = jLayer.getMarker(i);
      float x = pm.getLocationVector().x / scale;
      float y = pm.getLocationVector().z / scale;

      if (pm.isActive() && (x * x + y * y < RADIUS * RADIUS)) {
        dw.setFill(true);

        // For OpenStreetMap the color is changing based on the URL
        dw.setColor(pm.getColour());

        dw.paintRect(x + RADIUS - 1, y + RADIUS - 1, 2, 2);
      }
    }
  }
コード例 #3
0
ファイル: DataHandler.java プロジェクト: GyuminLee/Android
 public void updateDistances(Location location) {
   for (Marker ma : markerList) {
     float[] dist = new float[3];
     Location.distanceBetween(
         ma.getLatitude(),
         ma.getLongitude(),
         location.getLatitude(),
         location.getLongitude(),
         dist);
     ma.setDistance(dist[0]);
   }
 }
コード例 #4
0
ファイル: DataHandler.java プロジェクト: GyuminLee/Android
  public void updateActivationStatus(MixContext mixContext) {

    Hashtable<Class, Integer> map = new Hashtable<Class, Integer>();

    for (Marker ma : markerList) {

      Class<? extends Marker> mClass = ma.getClass();
      map.put(mClass, (map.get(mClass) != null) ? map.get(mClass) + 1 : 1);

      boolean belowMax = (map.get(mClass) <= ma.getMaxObjects());
      // boolean dataSourceSelected = mixContext.isDataSourceSelected(ma.getDatasource());

      ma.setActive((belowMax));
    }
  }
コード例 #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    dataView = MixView.getDataView();

    selectedItemURL = new Vector<String>();
    listViewMenu = new Vector<SpannableString>();
    DataHandler jLayer = dataView.getDataHandler();
    if (dataView.isFrozen() && jLayer.getMarkerCount() > 0) {
      selectedItemURL.add("search");
    }
    /*add all marker items to a title and a URL Vector*/
    for (int i = 0; i < jLayer.getMarkerCount(); i++) {
      Marker ma = jLayer.getMarker(i);
      if (ma.isActive()) {
        if (ma.getURL() != null) {
          /* Underline the title if website is available*/
          underlinedTitle = new SpannableString(ma.getTitle());
          underlinedTitle.setSpan(new UnderlineSpan(), 0, underlinedTitle.length(), 0);
          listViewMenu.add(underlinedTitle);
        } else {
          listViewMenu.add(new SpannableString(ma.getTitle()));
        }
        /*the website for the corresponding title*/
        if (ma.getURL() != null) selectedItemURL.add(ma.getURL());
        /*if no website is available for a specific title*/
        else selectedItemURL.add("");
      }

      if (dataView.isFrozen()) {

        TextView searchNotificationTxt = new TextView(this);
        searchNotificationTxt.setVisibility(View.VISIBLE);
        searchNotificationTxt.setText(
            getString(R.string.search_active_1)
                + " "
                + DataSourceList.getDataSourcesStringList()
                + getString(R.string.search_active_2));
        searchNotificationTxt.setWidth(MixView.getdWindow().getWidth());

        searchNotificationTxt.setPadding(10, 2, 0, 0);
        searchNotificationTxt.setBackgroundColor(Color.DKGRAY);
        searchNotificationTxt.setTextColor(Color.WHITE);

        getListView().addHeaderView(searchNotificationTxt);
      }

      setListAdapter(
          new ArrayAdapter<SpannableString>(
              this, android.R.layout.simple_list_item_1, listViewMenu));
      getListView().setTextFilterEnabled(true);
      break;
    }
  }
コード例 #6
0
  private void doMixSearch(String query) {
    DataHandler jLayer = dataView.getDataHandler();
    if (!dataView.isFrozen()) {
      originalMarkerList = jLayer.getMarkerList();
      MixMap.originalMarkerList = jLayer.getMarkerList();
    }
    originalMarkerList = jLayer.getMarkerList();
    searchResultMarkers = new ArrayList<Marker>();
    Log.d("SEARCH-------------------0", "" + query);
    setSearchQuery(query);

    selectedItemURL = new Vector<String>();
    listViewMenu = new Vector<SpannableString>();
    for (int i = 0; i < jLayer.getMarkerCount(); i++) {
      Marker ma = jLayer.getMarker(i);

      if (ma.getTitle().toLowerCase().indexOf(searchQuery.toLowerCase()) != -1) {
        searchResultMarkers.add(ma);
        listViewMenu.add(new SpannableString(ma.getTitle()));
        /*the website for the corresponding title*/
        if (ma.getURL() != null) selectedItemURL.add(ma.getURL());
        /*if no website is available for a specific title*/
        else selectedItemURL.add("");
      }
    }
    if (listViewMenu.size() == 0) {
      Toast.makeText(this, getString(R.string.search_failed_notification), Toast.LENGTH_LONG)
          .show();
    } else {
      jLayer.setMarkerList(searchResultMarkers);
      dataView.setFrozen(true);
      finish();
      Intent intent1 = new Intent(this, MixListView.class);
      startActivityForResult(intent1, 42);
    }
  }
コード例 #7
0
ファイル: RemoteMarker.java プロジェクト: januar/KulinARMedan
 @Override
 public int compareTo(Marker another) {
   Marker rm = (Marker) another;
   return this.getID().compareTo(rm.getID());
 }