本文整理汇总了Java中com.nextgis.maplib.datasource.ngw.Resource类的典型用法代码示例。如果您正苦于以下问题:Java Resource类的具体用法?Java Resource怎么用?Java Resource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Resource类属于com.nextgis.maplib.datasource.ngw包,在下文中一共展示了Resource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import com.nextgis.maplib.datasource.ngw.Resource; //导入依赖的package包/类
@Override
public View getView(
int i,
View view,
ViewGroup viewGroup)
{
//show loading view
if (mLoading) {
if (isAccountsDisabled())
return getLoadingView(view);
else if (i > 0)
return getLoadingView(view);
}
switch (mCurrentResource.getType()) {
case Connection.NGWResourceTypeConnections:
final Connection connection = (Connection) getItem(i);
return getConnectionView(connection, view);
case Connection.NGWResourceTypeConnection:
case Connection.NGWResourceTypeResourceGroup:
Resource resource = (Resource) getItem(i);
return getResourceView(resource, view);
default:
return null;
}
}
示例2: goUp
import com.nextgis.maplib.datasource.ngw.Resource; //导入依赖的package包/类
public void goUp() {
INGWResource resource = mCurrentResource.getParent();
if (resource instanceof Resource) {
Resource resourceGroup = (Resource) resource;
if (resourceGroup.getRemoteId() == 0) {
resource = resource.getParent();
}
}
mCurrentResource = resource;
notifyDataSetChanged();
}
示例3: doInBackground
import com.nextgis.maplib.datasource.ngw.Resource; //导入依赖的package包/类
@Override
protected Boolean doInBackground(Void... voids) {
Map<String, Resource> keys = new HashMap<>();
keys.put(mConnection.getLogin(), null);
if (mConnection.connect(Constants.NGW_ACCOUNT_GUEST.equals(mConnection.getLogin()))) {
NGWUtil.getResourceByKey(mActivity, mConnection, keys);
if (mIsCancelled)
return false;
Resource resource = keys.get(mConnection.getLogin());
if (resource != null) {
MapBase map = MapBase.getInstance();
NGWTrackLayer layer = new NGWTrackLayer(mActivity.getApplicationContext(), map.createLayerStorage());
layer.setName(mActivity.getString(R.string.tracks));
layer.setRemoteId(resource.getRemoteId());
layer.setAccountName(mConnection.getName());
layer.setVisible(false);
try {
layer.createFromNGW(this);
if (mIsCancelled) {
layer.delete();
return false;
}
map.addLayer(layer);
map.save();
return true;
} catch (NGException | IOException | JSONException e) {
e.printStackTrace();
}
}
}
return false;
}
示例4: assignLayers
import com.nextgis.maplib.datasource.ngw.Resource; //导入依赖的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();
}
示例5: onUpdate
import com.nextgis.maplib.datasource.ngw.Resource; //导入依赖的package包/类
public void onUpdate(INGWResource mCurrentResource)
{
if (null == mLinearLayout || null == mCurrentResource) {
return;
}
mLinearLayout.removeAllViewsInLayout();
INGWResource parent = mCurrentResource;
while (null != parent) {
if (!mShowAccounts && parent instanceof Connections)
break;
//skip root resource
if (parent instanceof Resource) {
Resource resource = (Resource) parent;
if (resource.getRemoteId() == 0) {
parent = parent.getParent();
continue;
}
}
final int id = parent.getId();
TextView name = new TextView(mContext);
String sName = parent.getName();
if (parent instanceof Connection && !mShowAccounts)
sName = "/ ";
name.setText(sName);
name.setTypeface(name.getTypeface(), Typeface.BOLD);
name.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
name.setSingleLine(true);
name.setMaxLines(1);
name.setBackgroundResource(android.R.drawable.list_selector_background);
name.setOnClickListener(
new View.OnClickListener()
{
@Override
public void onClick(View v)
{
setCurrentResourceId(id);
}
});
mLinearLayout.addView(name, 0);
parent = parent.getParent();
if (null != parent) {
ImageView image = new ImageView(mContext);
int px = ControlHelper.dpToPx(16, mContext.getResources());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(px, px);
image.setLayoutParams(params);
image.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_next_light));
mLinearLayout.addView(image, 0);
}
}
}