当前位置: 首页>>代码示例>>Java>>正文


Java NGWVectorLayer类代码示例

本文整理汇总了Java中com.nextgis.maplib.map.NGWVectorLayer的典型用法代码示例。如果您正苦于以下问题:Java NGWVectorLayer类的具体用法?Java NGWVectorLayer怎么用?Java NGWVectorLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NGWVectorLayer类属于com.nextgis.maplib.map包,在下文中一共展示了NGWVectorLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveMark

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
public static String saveMark(Uri uri, String session, int id, String name, long timestamp, GeoPoint point) {
    NGWVectorLayer markLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_MARK);
    if (markLayer != null) {
        String uniqueId = UUID.randomUUID().toString();
        ContentValues cv = new ContentValues();
        cv.put(LoggerApplication.FIELD_UNIQUE_ID, uniqueId);
        cv.put(LoggerApplication.FIELD_SESSION, session);
        cv.put(LoggerApplication.FIELD_MARK_ID, id);
        cv.put(LoggerApplication.FIELD_NAME, name);
        cv.put(LoggerApplication.FIELD_TIMESTAMP, timestamp * 1d);
        cv.put(LoggerApplication.FIELD_DATETIME, timestamp);
        try {
            cv.put(FIELD_GEOM, point.toBlob());
        } catch (IOException e) {
            e.printStackTrace();
        }

        markLayer.insert(uri, cv);
        return uniqueId;
    }

    return null;
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:24,代码来源:BaseEngine.java

示例2: saveData

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
public void saveData(ArrayList<InfoItem> items, String markId) {
	NGWVectorLayer cellLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_CELL);
	if (cellLayer != null) {
		ContentValues cv = new ContentValues();
		for (InfoItem item : items) {
			cv.clear();
			cv.put(LoggerApplication.FIELD_MARK, markId);
			cv.put(LoggerConstants.HEADER_GEN, (String) item.getColumn(LoggerConstants.HEADER_GEN).getValue());
			cv.put(LoggerConstants.HEADER_TYPE, (String) item.getColumn(LoggerConstants.HEADER_TYPE).getValue());
			cv.put(LoggerConstants.HEADER_ACTIVE, (String) item.getColumn(LoggerConstants.HEADER_ACTIVE).getValue());
			cv.put(LoggerConstants.HEADER_MCC, (String) item.getColumn(LoggerConstants.HEADER_MCC).getValue());
			cv.put(LoggerConstants.HEADER_MNC, (String) item.getColumn(LoggerConstants.HEADER_MNC).getValue());
			cv.put(LoggerConstants.HEADER_LAC, (String) item.getColumn(LoggerConstants.HEADER_LAC).getValue());
			cv.put(LoggerConstants.HEADER_CID, (String) item.getColumn(LoggerConstants.HEADER_CID).getValue());
			cv.put(LoggerConstants.HEADER_PSC, (String) item.getColumn(LoggerConstants.HEADER_PSC).getValue());
			cv.put(LoggerConstants.HEADER_POWER, (String) item.getColumn(LoggerConstants.HEADER_POWER).getValue());
               cv.put(Constants.FIELD_GEOM, LoggerApplication.getNullGeometry());

			cellLayer.insert(mUri, cv);
		}
	}
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:24,代码来源:CellEngine.java

示例3: saveData

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
public void saveData(ArrayList<InfoItem> items, String markId) {
    NGWVectorLayer externalLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_EXTERNAL);
    if (externalLayer != null) {
        ContentValues cv = new ContentValues();
        cv.put(LoggerApplication.FIELD_MARK, markId);

        String data = "";
        for (InfoItem item : items)
            data += item.getColumns().get(0).getValue() + LoggerConstants.CSV_SEPARATOR;

        cv.put(LoggerApplication.FIELD_DATA, data);
        cv.put(Constants.FIELD_GEOM, LoggerApplication.getNullGeometry());

        externalLayer.insert(mUri, cv);
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:18,代码来源:ArduinoEngine.java

示例4: startSession

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private String startSession(String name, String userName, String deviceInfo) {
    NGWVectorLayer sessionLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_SESSION);
    if (sessionLayer != null) {
        String id = UUID.randomUUID().toString();
        ContentValues cv = new ContentValues();
        cv.put(LoggerApplication.FIELD_NAME, name);
        cv.put(LoggerApplication.FIELD_USER, userName);
        cv.put(LoggerApplication.FIELD_DEVICE_INFO, deviceInfo);
        cv.put(LoggerApplication.FIELD_UNIQUE_ID, id);
        cv.put(Constants.FIELD_GEOM, LoggerApplication.getNullGeometry());

        sessionLayer.insert(mUri, cv);
        return id;
    }

    return null;
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:18,代码来源:MainActivity.java

示例5: loadSessions

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private void loadSessions() {
    mSessionsName.clear();
    mSessions.clear();
    NGWVectorLayer sessionLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_SESSION);
    if (sessionLayer != null) {
        Cursor ids = sessionLayer.query(new String[]{Constants.FIELD_ID}, null, null, null, null);
        if (ids != null && ids.moveToFirst()) {
            do {
                Feature feature = sessionLayer.getFeature(ids.getLong(0));
                if (feature == null)
                    continue;

                boolean isCurrentSession = mSessionId != null && mSessionId.equals(feature.getFieldValueAsString(LoggerApplication.FIELD_UNIQUE_ID));
                mSessions.add(feature);
                String name = feature.getFieldValueAsString(LoggerApplication.FIELD_NAME);
                mSessionsName.add(isCurrentSession ? name + " *" + getString(R.string.scl_current_session) + "*" : name);
            } while (ids.moveToNext());

            ids.close();
        }

        Collections.sort(mSessionsName, Collections.reverseOrder());
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:25,代码来源:SessionsActivity.java

示例6: execute

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
public boolean execute(IProgressor progressor) {
    try {
        NGWVectorLayer ngwVectorLayer = (NGWVectorLayer) mLayer;
        if(null == ngwVectorLayer)
            return false;

        for (String id : mLookupIds) {
            NGWLookupTable table = new NGWLookupTable(mLayer.getContext(), mLayerGroup.createLayerStorage());
            table.setAccountName(((NGWVectorLayer) mLayer).getAccountName());
            table.setRemoteId(Long.parseLong(id));
            table.setSyncType(Constants.SYNC_ALL);
            table.setName(getText(R.string.layer_lookuptable) + " #" + id);
            table.fillFromNGW(null);
            mLayerGroup.addLayer(table);
        }

        ngwVectorLayer.createFromNGW(progressor);
    } catch (JSONException | IOException | SQLiteException | NGException | ClassCastException e) {
        e.printStackTrace();

        String logMsg = e.getLocalizedMessage();

        if(null != logMsg) {
            if (null != progressor)
                progressor.setMessage(logMsg);

            setMessage(logMsg);
        }
        notifyError(mProgressMessage);
        return false;
    }

    return true;
}
 
开发者ID:nextgis,项目名称:android_maplibui,代码行数:36,代码来源:LayerFillService.java

示例7: delete

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
public boolean delete() {
    File form = new File(mPath, ConstantsUI.FILE_FORM);
    if (form.exists()) {
        try {
            ArrayList<String> lookupTableIds = LayerUtil.fillLookupTableIds(form);
            MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
            if (null == map)
                throw new IllegalArgumentException("The map should extends MapContentProviderHelper or inherited");

            for (int i = 0; i < map.getLayerCount(); i++) {
                if (map.getLayer(i) instanceof NGWVectorLayer) {
                    form = new File(map.getLayer(i).getPath(), ConstantsUI.FILE_FORM);
                    if (form.exists()) {
                        ArrayList<String> otherIds = LayerUtil.fillLookupTableIds(form);
                        lookupTableIds.removeAll(otherIds);
                    }
                }
            }

            if (lookupTableIds.size() > 0)
                for (int i = 0; i < map.getLayerCount(); i++) {
                    if (map.getLayer(i) instanceof NGWLookupTable) {
                        NGWLookupTable table = (NGWLookupTable) map.getLayer(i);
                        String id = table.getRemoteId() + "";
                        if (table.getAccountName().equals(mAccountName) && lookupTableIds.contains(id)) {
                            map.removeLayer(table);
                            table.delete();
                            i--;
                        }
                    }
                }
        } catch (IOException | JSONException e) {
            e.printStackTrace();
        }
    }

    return super.delete();
}
 
开发者ID:nextgis,项目名称:android_maplibui,代码行数:40,代码来源:NGWVectorLayerUI.java

示例8: appendData

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private void appendData(IFormControl control, JSONObject element) throws JSONException {
    if (mLayer instanceof NGWVectorLayer)
        element.put(SyncStateContract.Columns.ACCOUNT_NAME, ((NGWVectorLayer) mLayer).getAccountName());

    if (control instanceof Counter && mTable != null && mRow != -1) {
        JSONObject attrs = element.getJSONObject(JSON_ATTRIBUTES_KEY);
        if (!attrs.isNull(Counter.PREFIX_LIST)) {
            String prefix = attrs.getString(Counter.PREFIX_LIST);
            prefix = mTable.get(prefix).get(mRow);
            attrs.put(Counter.PREFIX, prefix);
        }

        if (!attrs.isNull(Counter.SUFFIX_LIST)) {
            String suffix = attrs.getString(Counter.SUFFIX_LIST);
            suffix = mTable.get(suffix).get(mRow);
            attrs.put(Counter.SUFFIX, suffix);
        }
    }
}
 
开发者ID:nextgis,项目名称:android_maplibui,代码行数:20,代码来源:FormBuilderModifyAttributesActivity.java

示例9: addFragments

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
protected void addFragments() {
    mAdapter.addFragment(new StyleFragment(), R.string.style);
    mAdapter.addFragment(new FieldsFragment(), R.string.fields);
    if (mLayer instanceof NGWVectorLayer)
        mAdapter.addFragment(new SyncFragment(), R.string.sync);
    LayerGeneralSettingsFragment generalSettingsFragment = new LayerGeneralSettingsFragment();
    generalSettingsFragment.setRoot(mLayer, this);
    mAdapter.addFragment(generalSettingsFragment, R.string.general);
    CacheFragment cacheFragment = new CacheFragment();
    cacheFragment.setActivity(this);
    mAdapter.addFragment(cacheFragment, R.string.cache);
}
 
开发者ID:nextgis,项目名称:android_maplibui,代码行数:14,代码来源:VectorLayerSettingsActivity.java

示例10: createLayers

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private void createLayers(HashMap<String, INGWResource> keys) {
    for (String table : keys.keySet()) {
        if (keys.get(table) == null) {
            NGWVectorLayer layer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(table);
            if (layer != null) {
                NGWCreateNewResourceTask createLayer = new NGWCreateNewResourceTask(this, mConnection, mGroupId);
                createLayer.setLayer(layer);
                createLayer.execute();
                mCounter++;
            }
        }
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:14,代码来源:NGWLoginActivity.java

示例11: assignLayers

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private void assignLayers(HashMap<String, INGWResource> keys) {
    IGISApplication app = (IGISApplication) getApplicationContext();
    String authority = app.getAuthority();
    String account = mConnection.getName();

    if (mVer == null) {
        try {
            AccountUtil.AccountData accountData = AccountUtil.getAccountData(this, account);
            mVer = NGWUtil.getNgwVersion(accountData.url, accountData.login, accountData.password);
        } catch (Exception ignored) {}
    }

    long id;
    for (String table : TABLES) {
        NGWVectorLayer layer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(table);
        if (layer != null && mVer != null) {
            id = ((Resource) keys.get(table)).getRemoteId();
            layer.mNgwVersionMajor = mVer.first;
            layer.mNgwVersionMinor = mVer.second;
            layer.mNGWLayerType = Connection.NGWResourceTypeVectorLayer;
            layer.setSyncType(Constants.SYNC_DATA);
            layer.setAccountName(account);
            layer.setRemoteId(id);
            layer.save();
            FeatureChanges.initialize(layer.getChangeTableName());
            layer.sync(authority, mVer, new SyncResult());
        }
    }

    mProgress.dismiss();
    finish();
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:33,代码来源:NGWLoginActivity.java

示例12: deleteMark

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
public static void deleteMark(Uri uri, String uuid) {
    NGWVectorLayer markLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_MARK);
    if (markLayer != null) {
        markLayer.delete(uri, LoggerApplication.FIELD_UNIQUE_ID + " = ?" , new String[]{uuid});
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:7,代码来源:BaseEngine.java

示例13: saveData

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
public void saveData(ArrayList<InfoItem> items, String markId) {
    NGWVectorLayer sensorLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_SENSOR);
    if (sensorLayer != null) {
        ContentValues cv = new ContentValues();
        cv.put(LoggerApplication.FIELD_MARK, markId);

        for (InfoItem item : items) {
            if (item.getColumn(HEADER_ACC_X) != null) {
                cv.put(HEADER_ACC_X, item.getColumn(HEADER_ACC_X).getValue() + "");
                cv.put(HEADER_ACC_Y, item.getColumn(HEADER_ACC_Y).getValue() + "");
                cv.put(HEADER_ACC_Z, item.getColumn(HEADER_ACC_Z).getValue() + "");
            }

            if (item.getColumn(HEADER_LINEAR_X) != null) {
                cv.put(HEADER_LINEAR_X, item.getColumn(HEADER_LINEAR_X).getValue() + "");
                cv.put(HEADER_LINEAR_Y, item.getColumn(HEADER_LINEAR_Y).getValue() + "");
                cv.put(HEADER_LINEAR_Z, item.getColumn(HEADER_LINEAR_Z).getValue() + "");
            }

            if (item.getColumn(HEADER_AZIMUTH) != null) {
                cv.put(HEADER_AZIMUTH, item.getColumn(HEADER_AZIMUTH).getValue() + "");
                cv.put(HEADER_PITCH, item.getColumn(HEADER_PITCH).getValue() + "");
                cv.put(HEADER_ROLL, item.getColumn(HEADER_ROLL).getValue() + "");
            }

            if (item.getColumn(HEADER_MAGNETIC_X) != null) {
                cv.put(HEADER_MAGNETIC_X, item.getColumn(HEADER_MAGNETIC_X).getValue() + "");
                cv.put(HEADER_MAGNETIC_Y, item.getColumn(HEADER_MAGNETIC_Y).getValue() + "");
                cv.put(HEADER_MAGNETIC_Z, item.getColumn(HEADER_MAGNETIC_Z).getValue() + "");
            }

            if (item.getColumn(HEADER_GYRO_X) != null) {
                cv.put(HEADER_GYRO_X, item.getColumn(HEADER_GYRO_X).getValue() + "");
                cv.put(HEADER_GYRO_Y, item.getColumn(HEADER_GYRO_Y).getValue() + "");
                cv.put(HEADER_GYRO_Z, item.getColumn(HEADER_GYRO_Z).getValue() + "");
            }

            if (item.getColumn(HEADER_GPS_LAT) != null) {
                cv.put(HEADER_GPS_LAT, item.getColumn(HEADER_GPS_LAT).getValue() + "");
                cv.put(HEADER_GPS_LON, item.getColumn(HEADER_GPS_LON).getValue() + "");
                cv.put(HEADER_GPS_ALT, item.getColumn(HEADER_GPS_ALT).getValue() + "");
                cv.put(HEADER_GPS_ACC, item.getColumn(HEADER_GPS_ACC).getValue() + "");
                cv.put(HEADER_GPS_SP, item.getColumn(HEADER_GPS_SP).getValue() + "");
                cv.put(HEADER_GPS_BE, item.getColumn(HEADER_GPS_BE).getValue() + "");
                cv.put(HEADER_GPS_SAT, item.getColumn(HEADER_GPS_SAT).getValue() + "");
                cv.put(HEADER_GPS_TIME, item.getColumn(HEADER_GPS_TIME).getValue() + "");
            }

            if (item.getColumn(HEADER_AUDIO) != null)
                cv.put(HEADER_AUDIO, item.getColumn(HEADER_AUDIO).getValue() + "");
        }

        cv.put(Constants.FIELD_GEOM, LoggerApplication.getNullGeometry());
        sensorLayer.insert(mUri, cv);
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:58,代码来源:SensorEngine.java

示例14: onPostExecute

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);

    String message;
    if (!MapUtil.isParsable(result)) {
        try {
            JSONObject obj = new JSONObject(result);
            Long id = obj.getLong(Constants.JSON_ID_KEY);

            if (mLayer != null) {
                ((NGWVectorLayer) mLayer).setSyncType(Constants.SYNC_DATA);
                mLayer.save();
                mLayer.toNGW(id, mConnection.getName(), Constants.SYNC_DATA, mVer);
                mCounter--;

                if (mCounter == 0) {
                    mProgress.dismiss();
                    finish();
                }
            }

            result = null;
        } catch (JSONException e) {
            result = "500";
            e.printStackTrace();
        }
    }

    if (result != null) {
        switch (result) {
            case "-999":
                message = getString(R.string.btn_ok);
                break;
            default:
                message = NetworkUtil.getError(mContext, result);
                break;
        }

        Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
        mProgress.dismiss();
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:44,代码来源:NGWLoginActivity.java

示例15: updateInterface

import com.nextgis.maplib.map.NGWVectorLayer; //导入依赖的package包/类
private void updateInterface() {
    mSessionId = mPreferences.getString(LoggerConstants.PREF_SESSION_ID, null);
    if (TextUtils.isEmpty(mSessionId)) {
        findViewById(R.id.rl_modes).setVisibility(View.GONE);
        mButtonSession.setText(R.string.btn_session_open);

        mTvSessionName.setText("");
        mTvStartedTime.setText("");
        mTvFinishedTime.setText("");
        mTvMarksCount.setText("");
        mTvRecordsCount.setText("");
    } else {
        findViewById(R.id.rl_modes).setVisibility(View.VISIBLE);
        mButtonSession.setText(R.string.btn_session_close);

        String sessionName;
        NGWVectorLayer sessionLayer = (NGWVectorLayer) MapBase.getInstance().getLayerByPathName(LoggerApplication.TABLE_SESSION);
        if (sessionLayer != null) {
            String session = getSessionName(mSessionId);
            if (!TextUtils.isEmpty(session))
                sessionName = session;
            else {
                closeSession();
                return;
            }
        } else {
            closeSession();
            return;
        }

        mTvSessionName.setText(sessionName);
        Long time = mPreferences.getLong(LoggerConstants.PREF_TIME_START, 0);
        mTvStartedTime.setText(time > 0 ? millisToDate(time) : getString(R.string.service_stopped));
        time = mPreferences.getLong(LoggerConstants.PREF_TIME_FINISH, 0);
        mTvFinishedTime.setText(time > 0 ? millisToDate(time) : getString(R.string.service_stopped));
        mTvMarksCount.setText(mPreferences.getInt(LoggerConstants.PREF_MARKS_COUNT, 0) + "");
        mTvRecordsCount.setText(mPreferences.getInt(LoggerConstants.PREF_RECORDS_COUNT, 0) + "");
    }

    boolean isServiceRunning = isLoggerServiceRunning();
    setActionBarProgress(isServiceRunning);

    mButtonService.setText(getString(isServiceRunning ? R.string.btn_service_stop : R.string.btn_service_start));
    mButtonSession.setEnabled(!isServiceRunning);

    if (isServiceRunning)
        mTvFinishedTime.setText(R.string.service_running);
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:49,代码来源:MainActivity.java


注:本文中的com.nextgis.maplib.map.NGWVectorLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。