- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注 Sencha Touch 的地理定位用法 tutorial但我需要同时使用 classic
和 modern
工具包。在 sencha app watch/refresh/build
命令期间,我收到 Ext.util.Geolocation 类要求的错误;
C2008: Requirement had no matching files (Ext.util.Geolocation)
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files for /..../WeatherView.js::ClassRequire::Ext.util.Geolocation
[ERR] at sun.reflect.Delegat
[ERR] ingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
尽管当我尝试使用 sencha app watch modern
命令时,我收到了 Ext.form.field.Text
的错误。我无法在我的应用中禁用 textfield
用法。那么地理定位服务的解决方案是什么?
这是发生错误的代码片段:
refreshGeoLocation : function( refresh ) {
if (!this.geoLocationObj || (true == refresh)) {
Ext.create('Ext.util.Geolocation', {
autoUpdate: false,
listeners: {
locationupdate: function (geo) {
Ext.Msg.alert('Refresh Geolocation', 'New latitude: ' + geo.getLatitude() + ' , Longitude: ' + geo.getLongitude(), Ext.emptyFn);
},
locationerror: function (geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
if (bTimeout) {
alert('Timeout occurred');
} else {
alert('Error occurred');
}
}
}
});
this.geoLocationObj.updateLocation();
}
}
(*) 教程:https://wtcindia.wordpress.com/2013/02/08/using-yahoo-weather-api-in-sencha-touch/
最佳答案
此错误的原因(Requirement had no matching files (Ext.util.Geolocation)
)可能是你有的某个地方(app.js 或 Application.js
)需要 本类(class)Ext.util.Geolocation
.
Ext.util.Geolocation
仅在 modern
工具包中可用。因此,您应该在 modern
文件夹中要求而不是 app.js
。
For this "Despite when I try to sencha app watch modern command, then I get an error for
Ext.form.field.Text
."
此类 Ext.form.field.Text
仅在经典工具包中可用。而不是这个 Ext.form.field.Text
你需要用这个 Ext.field.Text
在 modern
工具包中。
如果你想在classic
工具包中使用Geolocation
,那么你需要在classic
文件夹中添加自定义类。
更多详情可以引用我的 ExtJS-GeoLocation 项目。
我希望这会指导您解决错误..
/**
* Provides a cross browser class for retrieving location information.
* Source from https://docs.sencha.com/extjs/6.0.0/modern/src/Geolocation.js.html
* Based on the [Geolocation API Specification](http://dev.w3.org/geo/api/spec-source.html)
*
* When instantiated, by default this class immediately begins tracking location information,
* firing a {@link #locationupdate} event when new location information is available. To disable this
* location tracking (which may be battery intensive on mobile devices), set {@link #autoUpdate} to `false`.
*
* When this is done, only calls to {@link #updateLocation} will trigger a location retrieval.
*
* A {@link #locationerror} event is raised when an error occurs retrieving the location, either due to a user
* denying the application access to it, or the browser not supporting it.
*
* The below code shows a GeoLocation making a single retrieval of location information.
*
* //{GeoLocation} is your application name
* var geo = Ext.create('GeoLocation.util.Geolocation', {
* autoUpdate: false,
* listeners: {
* locationupdate: function(geo) {
* Ext.Msg.alert('Success', `New latitude: ${geo.getLatitude()} <br>New Longitude: ${geo.getLongitude()}`);
* },
* locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
* if(bTimeout){
* Ext.Msg.alert('Error', 'Timeout occurred.');
* } else {
* Ext.Msg.alert('Error', 'Error occurred');
* }
* }
* }
* });
* geo.updateLocation();
*/
//{GeoLocation} is your application name
Ext.define('GeoLocation.util.Geolocation', {
extend: 'Ext.Evented',
alternateClassName: ['Geolocation'],
config: {
/**
* @event locationerror
* Raised when a location retrieval operation failed.
*
* In the case of calling updateLocation, this event will be raised only once.
*
* If {@link #autoUpdate} is set to `true`, this event could be raised repeatedly.
* The first error is relative to the moment {@link #autoUpdate} was set to `true`
* (or this {@link Ext.util.Geolocation} was initialized with the {@link #autoUpdate} config option set to `true`).
* Subsequent errors are relative to the moment when the device determines that it's position has changed.
* @param {Ext.util.Geolocation} this
* @param {Boolean} timeout
* Boolean indicating a timeout occurred
* @param {Boolean} permissionDenied
* Boolean indicating the user denied the location request
* @param {Boolean} locationUnavailable
* Boolean indicating that the location of the device could not be determined.
* For instance, one or more of the location providers used in the location acquisition
* process reported an internal error that caused the process to fail entirely.
* @param {String} message An error message describing the details of the error encountered.
*
* This attribute is primarily intended for debugging and should not be used
* directly in an application user interface.
*/
/**
* @event locationupdate
* Raised when a location retrieval operation has been completed successfully.
* @param {Ext.util.Geolocation} this
* Retrieve the current location information from the GeoLocation object by using the read-only
* properties: {@link #latitude}, {@link #longitude}, {@link #accuracy}, {@link #altitude}, {@link #altitudeAccuracy}, {@link #heading}, and {@link #speed}.
*/
/**
* @cfg {Boolean} autoUpdate
* When set to `true`, continually monitor the location of the device (beginning immediately)
* and fire {@link #locationupdate} and {@link #locationerror} events.
*/
autoUpdate: true,
/**
* @cfg {Number} frequency
* The frequency of each update if {@link #autoUpdate} is set to `true`.
*/
frequency: 10000,
/**
* @cfg {Number} latitude
* Read-only property representing the last retrieved
* geographical coordinate specified in degrees.
* @readonly
*/
latitude: null,
/**
* @cfg {Number} longitude
* Read-only property representing the last retrieved
* geographical coordinate specified in degrees.
* @readonly
*/
longitude: null,
/**
* @cfg {Number} accuracy
* Read-only property representing the last retrieved
* accuracy level of the latitude and longitude coordinates,
* specified in meters.
*
* This will always be a non-negative number.
*
* This corresponds to a 95% confidence level.
* @readonly
*/
accuracy: null,
/**
* @cfg {Number} altitude
* Read-only property representing the last retrieved
* height of the position, specified in meters above the ellipsoid
* [WGS84](http://dev.w3.org/geo/api/spec-source.html#ref-wgs).
* @readonly
*/
altitude: null,
/**
* @cfg {Number} altitudeAccuracy
* Read-only property representing the last retrieved
* accuracy level of the altitude coordinate, specified in meters.
*
* If altitude is not null then this will be a non-negative number.
* Otherwise this returns `null`.
*
* This corresponds to a 95% confidence level.
* @readonly
*/
altitudeAccuracy: null,
/**
* @cfg {Number} heading
* Read-only property representing the last retrieved
* direction of travel of the hosting device,
* specified in non-negative degrees between 0 and 359,
* counting clockwise relative to the true north.
*
* If speed is 0 (device is stationary), then this returns `NaN`.
* @readonly
*/
heading: null,
/**
* @cfg {Number} speed
* Read-only property representing the last retrieved
* current ground speed of the device, specified in meters per second.
*
* If this feature is unsupported by the device, this returns `null`.
*
* If the device is stationary, this returns 0,
* otherwise it returns a non-negative number.
* @readonly
*/
speed: null,
/**
* @cfg {Date} timestamp
* Read-only property representing when the last retrieved
* positioning information was acquired by the device.
* @readonly
*/
timestamp: null,
//PositionOptions interface
/**
* @cfg {Boolean} allowHighAccuracy
* When set to `true`, provide a hint that the application would like to receive
* the best possible results. This may result in slower response times or increased power consumption.
* The user might also deny this capability, or the device might not be able to provide more accurate
* results than if this option was set to `false`.
*/
allowHighAccuracy: false,
/**
* @cfg {Number} timeout
* The maximum number of milliseconds allowed to elapse between a location update operation
* and the corresponding {@link #locationupdate} event being raised. If a location was not successfully
* acquired before the given timeout elapses (and no other internal errors have occurred in this interval),
* then a {@link #locationerror} event will be raised indicating a timeout as the cause.
*
* Note that the time that is spent obtaining the user permission is **not** included in the period
* covered by the timeout. The `timeout` attribute only applies to the location acquisition operation.
*
* In the case of calling `updateLocation`, the {@link #locationerror} event will be raised only once.
*
* If {@link #autoUpdate} is set to `true`, the {@link #locationerror} event could be raised repeatedly.
* The first timeout is relative to the moment {@link #autoUpdate} was set to `true`
* (or this {@link Ext.util.Geolocation} was initialized with the {@link #autoUpdate} config option set to `true`).
* Subsequent timeouts are relative to the moment when the device determines that it's position has changed.
*/
timeout: Infinity,
/**
* @cfg {Number} maximumAge
* This option indicates that the application is willing to accept cached location information whose age
* is no greater than the specified time in milliseconds. If `maximumAge` is set to 0, an attempt to retrieve
* new location information is made immediately.
*
* Setting the `maximumAge` to Infinity returns a cached position regardless of its age.
*
* If the device does not have cached location information available whose age is no
* greater than the specified `maximumAge`, then it must acquire new location information.
*
* For example, if location information no older than 10 minutes is required, set this property to 600000.
*/
maximumAge: 0,
/**
* @private
*/
provider: undefined
},
updateMaximumAge: function() {
if (this.watchOperation) {
this.updateWatchOperation();
}
},
updateTimeout: function() {
if (this.watchOperation) {
this.updateWatchOperation();
}
},
updateAllowHighAccuracy: function() {
if (this.watchOperation) {
this.updateWatchOperation();
}
},
applyProvider: function(config) {
if (Ext.feature.has.Geolocation) {
if (!config) {
if (navigator && navigator.geolocation) {
config = navigator.geolocation;
} else if (window.google) {
config = google.gears.factory.create('beta.geolocation');
}
}
} else {
this.fireEvent('locationerror', this, false, false, true, 'This device does not support Geolocation.');
}
return config;
},
updateAutoUpdate: function(newAutoUpdate, oldAutoUpdate) {
var me = this,
provider = me.getProvider();
if (oldAutoUpdate && provider) {
Ext.uninterval(me.watchOperationId);
me.watchOperationId = null;
}
if (newAutoUpdate) {
if (!provider) {
me.fireEvent('locationerror', me, false, false, true, null);
return;
}
try {
me.updateWatchOperation();
} catch (e) {
me.fireEvent('locationerror', me, false, false, true, e.message);
}
}
},
/**
* @private
*/
updateWatchOperation: function() {
var me = this,
provider = me.getProvider();
// The native watchPosition method is currently broken in iOS5...
if (me.watchOperationId) {
Ext.uninterval(me.watchOperationId);
}
function pollPosition() {
provider.getCurrentPosition(
Ext.bind(me.fireUpdate, me),
Ext.bind(me.fireError, me),
me.parseOptions()
);
}
pollPosition();
me.watchOperationId = Ext.interval(pollPosition, this.getFrequency());
},
/**
* Executes a onetime location update operation,
* raising either a {@link #locationupdate} or {@link #locationerror} event.
*
* Does not interfere with or restart ongoing location monitoring.
* @param {Function} callback
* A callback method to be called when the location retrieval has been completed.
*
* Will be called on both success and failure.
*
* The method will be passed one parameter, {@link Ext.util.Geolocation}
* (**this** reference), set to `null` on failure.
*
* geo.updateLocation(function (geo) {
* alert('Latitude: ' + (geo !== null ? geo.latitude : 'failed'));
* });
*
* @param {Object} [scope]
* The scope (**this** reference) in which the handler function is executed.
*
* **If omitted, defaults to the object which fired the event.**
*
* @param {Object} [positionOptions] (private) See W3C spec
*/
updateLocation: function(callback, scope, positionOptions) {
var me = this,
provider = me.getProvider();
var failFunction = function(message, error) {
if (error) {
me.fireError(error);
} else {
me.fireEvent('locationerror', me, false, false, true, message);
}
if (callback) {
callback.call(scope || me, null, me); //last parameter for legacy purposes
}
};
if (!provider) {
failFunction(null);
return;
}
try {
provider.getCurrentPosition(
//success callback
function(position) {
me.fireUpdate(position);
if (callback) {
callback.call(scope || me, me, me); //last parameter for legacy purposes
}
},
//error callback
function(error) {
failFunction(null, error);
},
positionOptions || me.parseOptions()
);
} catch (e) {
failFunction(e.message);
}
},
/**
* @private
*/
fireUpdate: function(position) {
var me = this,
coords = position.coords;
this.position = position;
me.setConfig({
timestamp: position.timestamp,
latitude: coords.latitude,
longitude: coords.longitude,
accuracy: coords.accuracy,
altitude: coords.altitude,
altitudeAccuracy: coords.altitudeAccuracy,
heading: coords.heading,
speed: coords.speed
});
me.fireEvent('locationupdate', me);
},
/**
* @private
*/
fireError: function(error) {
var errorCode = error.code;
this.fireEvent('locationerror', this,
errorCode == error.TIMEOUT,
errorCode == error.PERMISSION_DENIED,
errorCode == error.POSITION_UNAVAILABLE,
error.message == undefined ? null : error.message
);
},
/**
* @private
*/
parseOptions: function() {
var timeout = this.getTimeout(),
ret = {
maximumAge: this.getMaximumAge(),
enableHighAccuracy: this.getAllowHighAccuracy()
};
//Google doesn't like Infinity
if (timeout !== Infinity) {
ret.timeout = timeout;
}
return ret;
},
destroy: function() {
this.setAutoUpdate(false);
this.callParent();
}
});
关于javascript - 经典工具包的 ExtJS 地理定位用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47969171/
我想知道地理数据、几何数据和数据库系统(例如 Oracle 或 SqlSqerver)中表示空间数据的标准数据类型之间有什么区别? 对我来说看起来是一样的,但我知道肯定有区别。. 最佳答案 首先,地理
我正在寻找用于存储 map 的理想数据库或数据结构的建议。本质上, map 由“道路”组成,如道路、路径等。道路包含节点(具有纬度和经度坐标,有时还有高度。) 任何此类数据库或结构: 应该能够快速(毫
我最近将一些预装的国家和省份形状下载到 Sql Server 2008 中 http://sqlsamplegeo.codeplex.com/ 除了地理列,每个国家和省都有一个“ShapeArea”和
我对google Analytics(分析)地理如何工作(特别是对于出差用户)有疑问。例如,如果我是森尼韦尔市的用户,并且我打开了一个应用程序,则Google ID在用户ID级别的分析将说用户数= 1
我正在使用 Geo::IP 对 IP 地址执行位置查找。一切正常,直到我遇到一个不在地理 IP 查找数据库中的 IP 地址并且程序突然关闭并给出此错误 Can't call method "city"
通用(或设备无关)物理位置的结构是什么?我的猜测是它可能是一个有两个长字段的结构,或者类似的东西。 此外,给定一个目的地位置和两个候选位置,是否有一种简单的算法可以确定哪个候选位置最接近目的地?我并不
我正在使用 d3 geomaps 创建美国的地理 map 。当我将鼠标悬停在状态上时,我希望突出显示该状态。那可能吗?这是我当前的代码:
在geoviews guide for Bokeh ,它指出 Bokeh 仅支持墨卡托投影,但大多数示例投影使用 PlateCarree,然后输出看起来像墨卡托投影。 有人知道图形的投影和输出是怎么回
我有一个geodataframe'all_locations',其中有一个几何列和一个带有点名称的列。在 map 上绘制点工作正常,但我想用位置名称注释这些点。 ['位置'] ['几何'] BUITH
我正在尝试在 Canvas 中缩放 map 。 var projection = d3.geoMercator() projection.fitExtent([[margin.left, margin
我目前正在处理这段代码,一切正常,但是当我用鼠标悬停在一个国家/地区时,我只希望国家/地区名称出现在标签中,而不是相关值。我可以这样做吗?如果是,怎么办? 提前致谢! 这是javascript代码:
我正在尝试在 mac os 上使用 Geodjango,我使用 postgresql 并安装了 GEOS,但出现此错误: dlopen(/usr/local/lib/libgeos_c.dylib,
我正在研究 GeoViews,我想知道我们是否可以将 slider 作为 GeoViews 中等值线图的输入。 我在 gdf 中有另一个变量,它是年份。是否可以使用 slider 显示年度 Tot
我有一个 Geometry (看起来像 WKB) 我的 postgres/postgis 数据库中的对象,我已经转储到 BigQuery 来做一些有趣的事情。我看到它存储为 bytes .我如何构建一
我正在使用 DPM 进行 azure 在线备份,并且想要将冗余从 Geo 更改为 Local,但它显示为灰色。有办法改变吗? 我不想为此创建新的错误,然后我必须再次将所有内容从 DPM 重新上传到 A
我正在实现 Google 地理 map ,我想做的是,例如,如果我单击 US在 map 上,我会将国家/地区名称作为警报(例如,如果我单击美国,我必须将美国作为警报),我最终可以将其用作变量。当我尝试
我正在制作一张具有缩放和平移功能的世界地图。我在某些城市上画了圆圈,圆圈的半径由数据决定。当鼠标悬停在这些圆圈上时,将出现一个工具提示来显示数据。 代码结构为 //在此选择上调用缩放行为 - 让我们调
我需要一个函数来计算一对 WGS 84 之间的距离定位到高精度,我计划使用 boost geometry 中的 geographic 函数. boost geometry Design Rationa
我正在尝试缓冲数据集中半径为 100 公里的点。我正在使用函数 gBuffer来自包裹rgeos .这是我到目前为止所拥有的: head( sampledf ) # postalcode
我正在用 C# 开发一个应用程序,它将使用 SQL Server 2008 中的“地理”数据类型来使用和存储地理位置。我计划使用 Entity Framework ,但很快发现它不支持空间数据。有没有
我是一名优秀的程序员,十分优秀!