怎么在Ubuntu Scope中获取location地址信息

怎么在Ubuntu Scope中获取location地址信息,第1张

1)创建一个简单的Scope应用

我们首先打开SDK,并选择“Unity Scope”模版:

接下来,我们选择“Empty scope”。这样我们就创建了我们的一个最基本的scope了。

我们可以运行我们的Scope。这是一个最基本的Scope。

2)加入代码获取Location信息

为了获取位置信息,我们对我们的代码进行设置。首先打开"data"文件夹中的ini文件,并加入LocationDataNeeded=true。这样整个文件显示为:

[cpp] view plain copy

[ScopeConfig]

DisplayName = Scopetest Scope

Description = This is a Scopetest scope

Art = screenshotpng

Author = Firstname Lastname

Icon = iconpng

LocationDataNeeded=true

[Appearance]

PageHeaderLogo = logopng

同时我们打开scopecpp文件,并修改为:

[cpp] view plain copy

#include <unity/scopes/SearchMetadatah> // added

void Query::run(sc::SearchReplyProxy const& reply) {

try {

cerr << "starting to get the location" << endl;

auto metadata = search_metadata();

if (metadatahas_location()) {

cerr << "it has location data" << endl;

auto location = metadatalocation();

if (locationhas_country_code()) {

cerr << "country code: " << locationcountry_code() << endl;

}

if ( locationhas_area_code() ) {

cerr << "area code: " << locationarea_code() << endl;

}

if ( locationhas_city() ) {

cerr << "city: " << locationcity() << endl;

}

if ( locationhas_country_name() ) {

cerr << "" << locationcountry_name() << endl;

}

if ( locationhas_altitude()) {

cerr << "altitude: " << locationaltitude() << endl;

cerr << "longitude: " << locationlongitude() << endl;

cerr << "latitude: " << locationlatitude() << endl;

}

if ( locationhas_horizontal_accuracy()) {

cerr << "horizotal accuracy: " << locationhorizontal_accuracy() << endl;

}

if ( locationhas_region_code() ) {

cerr << "region code: " << locationregion_code() << endl;

}

if ( locationhas_region_name() ) {

cerr << "region name: " << locationregion_name() << endl;

}

if ( locationhas_zip_postal_code() ) {

cerr << "zip postal code: " << locationzip_postal_code() << endl;

}

}

}

我们通过打印的方式来查看我们所收到的位置信息。在手机上运行,并同时在desktop上执行如下的命令:

我们可以看到我们所需要的位置信息。通过这些信息,我们可以在我们的Scope中使用。

所有的源码可以在如下的地址找到:

bzr branch lp:~liu-xiao-guo/debiantrial/scope

答第一问:

没错,不仅有 row 和 $index ,而且还有 column

如图。

遇到问题多查文档。

网页链接

答第二问:

写一个按钮,绑定一个可以consolelog()的方法即可。

<div ng-app="myModule">

<h3>请分别修改父、子作用域表单里的值</h3>

<div ng-controller="myController">

父作用域:<br/>

<input type="text" ng-model="name" /><br/>

<input type="text" ng-model="sex" /><br/>

<input type="button" ng-click="say()" value="点击执行父域的say方法" /><br/>

子作用域:<br/>

<my-directive my-name="{{name}}" my-sex="sex" get-name='say()'></my-directive><br/>

</div>

</div>

<script src="/angular-158/angularjs"></script>

<script type="text/javascript">

var myModule = angularmodule("myModule", []);

myModulecontroller("myController", ['$scope', function($scope){

$scopename = "wangmeijian";

$scopesex = "boy";

$scopesay = function(){

alert( $scopename +" is a"+ $scopesex )

}

}])

myModuledirective("myDirective", function(){

return {

restrict: "EA",

scope: {

myName: "@",

mySex: "=",

getName: "&"

},

template: "<input type='text' ng-model='myName' /><br/>"+

"<input type='text' ng-model='mySex' /><br/>"+

"<input type='button' ng-click='getName()' value='点击执行子域的say方法' />",

}

})

</script>

第一步:将SCOPE的波形导入工作区(一个波形要配置一个SCOPE模块)

我要获取四个仿真波形(分别为输出正弦电压Uac,输出电感电流IL,母线电压Udc和输入电压Uin),故取四个scope模块。

选中Log data to workspace,保存形式为structure with time,变量名为Uac对应ScopeData4,IL对应ScopeData2,Udc对应ScopeData3,Uin对应ScopeData5,点击OK。

第二步:运行simulink仿真

第三部:仿真结束后,在工作区可以看到对应ScopeData数据。

第四部:在命令行窗口输入相应程序。

yyaxis left;%激活左坐标轴

xlabel('t/s');%设置横坐标单位

ylabel('电压/V');设置纵坐标单位

此时出现如下图的figure图。

plot(ScopeData4time,ScopeData4signalsvalues,'r');%输入Uac波形,为红色

hold on;%波形保留

plot(ScopeData3time,ScopeData3signalsvalues,'g');%输入Udc波形,为绿色

hold on;

plot(ScopeData5time,ScopeData5signalsvalues,'m');%输入Uin波形,为粉色

hold on;

此时figure图的纵坐标和横坐标发生变化,图像显示Uac,Udc,Uin的波形。

yyaxis right;%激活右坐标轴

ylabel('电流/A');%设置右坐标轴单位

ylim([-20,20]);%设置右坐标轴范围

此时右坐标轴如下图,坐标范围为-20~20,单位为“电流/A”

plot(ScopeData2time,ScopeData2signalsvalues,'b');%输入IL波形,颜色为蓝色。

yyaxis left;%再次激活左坐标轴

axis([01 02 -400 400]);%调整左坐标轴的横坐标时间为01~02s,纵坐标为-400~400V。

完整程序:>> yyaxis left;

>> xlabel('t/s');

>> ylabel('电压/V');

>> plot(ScopeData4time,ScopeData4signalsvalues,'r');

hold on;

plot(ScopeData3time,ScopeData3signalsvalues,'g');

hold on;

plot(ScopeData5time,ScopeData5signalsvalues,'m');

hold on;

>> yyaxis right;

ylabel('电流/A');

ylim([-20,20]);

>> plot(ScopeData2time,ScopeData2signalsvalues,'b');

>> yyaxis left;

>> axis([01 02 -400 400]);

第五步:选中箭头,点击坐标轴后,选中查看>属性检查器,对坐标轴进行编辑。

点击左纵坐标,等待属性检查器跳转,在标尺>选择坐标轴颜色为黑色,同理点击右纵坐标,等待属性检查器跳转,在标尺>选择坐标轴颜色为黑色。

选中框样式,去掉BOX的√,即去掉顶上边框。

选中波形线,对将线型由虚线改为实现,改变线宽为1,此时发现左边横左边单位没有了。

再次键入程序:ylabel('电压/V');即为最后的波形图。

修改一下,这个才是对的:

1,首先定义一个插入数据的存储过程,示例如下:

CREATE PROCEDURE [dbo][usp_InsertTool]

@T_Name nvarchar(50),

@T_CurrentPrice money,

@T_TypeID smallint,

@T_CreateTime smalldatetime,

@T_Description nvarchar(500),

@T_ID int OUTPUT

AS

--SET NOCOUNT ON

INSERT INTO [dbo][NATool] (

[T_Name],

[T_CurrentPrice],

[T_TypeID],

[T_CreateTime],

[T_Description],

[T_SoldCount]

) VALUES (

@T_Name,

@T_CurrentPrice,

@T_TypeID,

@T_CreateTime,

@T_Description

)

--SET @T_ID = SCOPE_IDENTITY()

SELECT SCOPE_IDENTITY()

GO

这样当你调用这个存储过程的时候存储过程在执行完成以后就会输出@T_ID,而@T_ID的值就是SCOPE_IDENTITY()

2,然后就是aspnet的获取了,定义一个ADD方法,示例如下:

public int Add(Tool entity)

{

if (entity == null)

return 0;

int result = 0;

object[] sqlParams = new object[] {

entityName,

entityCurrentPrice,

entityTypeID,

entityCreateTime,

entityDescription,

};

result = intParse(SqlHelperExecuteScalar(thisConn, "usp_InsertTool", sqlParams)ToString());

thisCloseConnection();

return result;

}

这里面的result也就是返回结果就是SCOPE_IDENTITY()的值了,这里面用到的SqlHelperExecuteScalar就是调用存储过程并返回存储过程的output参数,是个网上的公用模板,你应该有吧?如同jQuery的

以上就是关于怎么在Ubuntu Scope中获取location地址信息全部的内容,包括:怎么在Ubuntu Scope中获取location地址信息、这个里面的scop到底是个什么东西啊,scope.row是获取一行的全部数据,我看还有scope.index的、angularjs中怎么得到scope的父级域等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9512196.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存