PanoramaGL library类库详细解析

简介

PanoramaGL libraryis the firstopen sourcelibrary in the world to see panoramic views on the iPod Touch 1G, 2G, 3G and iPhone EDGE, 3G and 3GS.PanoramaGL图书馆是世界上第一个开源库和3GS看到全景1G的iPod上的触摸,2G,3G和iPhone的EDGE,3G网络。

SVNandsource codeinhttp://code.google.com/p/panoramagl/SVN源代码http://code.google.com/p/panoramagl/

Created byJavier Baez-Visit Ecuador Team创建者哈维尔贝兹-访问厄瓜多尔队

HelloPanorama形象

Important Note:Please add the credits in their projects when using the library.重要提示:请加入他们的项目中使用时的学分库。

Background背景

The supported features inversion 0.1 Betaare:0.1版测试版支持的功能有:

  • Supports OpenGLES 1.1支持OpenGLES 1.1
  • Tested with SDK 3.0 to 3.2测试用的SDK 3.0至3.2
  • Supports cubic, spherical and cylindrical panoramic images支持立方体,球形和圆柱形全景图像
  • Allows scrolling and continuous scrolling允许滚动和连续滚动
  • Supports scrolling left to right and from top to bottom using the accelerometer支持滚动从左到右,从上到下用加速度计
  • Allows to use the inertia to stop scrolling允许使用的惯性停止滚动
  • Supports zoom in and zoom out (moving two fingers on the screen)支持放大和缩小(在屏幕上移动两个手指)
  • Supports reset (placing three fingers on the screen)支持复位(置于屏幕上的三个手指)
  • Allows you to control the range of rotation in the x, y and z axis允许您控制在X,Y轴的旋转范围和Z轴
  • Supports Portrait, Portrait Upside Down, Landscape Left and Landscape Right orientation using the accelerometer支持人像,人像倒置,左,园林景观采用加速度计的正确方向
  • Supports for events on view支持对视图事件

Using the Code使用代码

To create a simple panoramic image viewer for the iPhone with PanoramaGL library, you must perform the following steps:要创建一个简单的iPhone与PanoramaGL库全景图像浏览器,你必须执行以下步骤:

1.1。Creating a project for iPhone (iPhone view based).创建用于iPhone项目(iPhone的视角)。

  • Open XCode开放的XCode
  • Go to "File -> New Project -> iPhone OS -> Application -> View-based Application"进入“文件 - >”新建项目“ - > iPhone操作系统 - >”应用程序 - >“查看应用程式”
创建项目
  • Click on "Choose" button and Save the project as "HelloPanorama"点击“选择”按钮并保存为“HelloPanorama”项目

2.2。ImportPanoramaGL library.进口PanoramaGL库

  • Download"PanoramaGL" library(Parent project folder)下载“PanoramaGL”库(父项目的文件夹)
  • Decompress "PanoramaGL" library (double click on zip file)解压缩“PanoramaGL”库(压缩文件双击)
  • Go to menu "Project -> Edit Active Target 'HelloPanorama'"到菜单“项目 - >”编辑主动目标'HelloPanorama'“
  • Go to "General" Tab进入“常规”标签
创建项目
  • Click on "+" button in the "Linked Library Section"点击“+”中的“链接库组”按钮

720

  • Click on "Add Other" button and find "PanoramaGL" project点击“添加其他”按钮,找到“PanoramaGL”项目

720

  • Select "PanoramaGL" folder, select "PanoramaGL.xcodeproj" file and click on "Add" button returning to "General" Tab"选择“PanoramaGL”文件夹,选择“PanoramaGL.xcodeproj”文件和“添加”点击按钮回到“常规”选项卡“

720

  • Go to "Direct Dependencies" section and click on "+" button继续“+”按钮,“直接相关性”部分,然后点击

720

  • Select "PanoramaGL" and click on "Add Target" button returning to "General" Tab选择“PanoramaGL”,并点击“添加目标”按钮返回到“常规”标签
  • Now go to "Build" Tab现在去“构建”标签

720

  • Find option"Header Search Paths"and double click on it.查找选项“标题搜索路径”,并双击它。

720

  • Click on "+" button and create a new setting string点击“+”按钮,创建一个新的设置字符串
  • Select "Recursive" check, write a relative path of "PanoramaGL" folder (in this case "../PanoramaGL" and click on "OK" button选择“递归”检查,写一个“PanoramaGL”文件夹的相对路径(在这种情况下,“.. / PanoramaGL”,然后点击“确定”按钮
  • Close "Project Active Target" window关闭“项目主动目标”窗口
  • Go to "Group & Files" panel, find and select "PanoramaGL.xcodeproj"进入“组和文件”面板中,找到并选择“PanoramaGL.xcodeproj”
  • Check target optionof "libPanoramaGL.a" on top-right panel as shown below:检查“libPanoramaGL.a”的右上方面板如下图所示的目标选择:

720

3.3。In the controller classHelloPanoramaViewControl<wbr>ler</wbr>must be implemented the code shown below:在控制器类HelloPanoramaViewControl<wbr>ler</wbr>必须执行下面的代码:

720 Collapse
#import<UIKit/UIKit.h>#进口<UIKit中/UIKit.h>#import" PLView.h"#导入“PLView.h”@interface HelloPanoramaViewControl<wbr>ler : UIViewController {</wbr>@接口HelloPanoramaViewControl<wbr>ler:UIViewController {</wbr>IBOutlet PLView * plView;IBOutlet PLView * plView;}}@property (nonatomic, retain) IBOutlet PLView *plView;@财产(非原子,保留)IBOutlet PLView * plView;@end@结束
4.4。 The view created must inherit fromPLView, instead ofUIView, so it must be modified in the resource fileHelloPanoramaViewControl<wbr>ler.xib</wbr>.视图创建必须继承自PLView的,而不是UIView,所以它必须是HelloPanoramaViewControl<wbr>ler.xib</wbr>修改资源文件。

5.5。 In the controller classHelloPanoramaViewControl<wbr>ler</wbr>must implement code in order to configure the view as shown below:在控制器类HelloPanoramaViewControl<wbr>ler</wbr>必须实现代码,以便配置视图如下图所示:
720 Collapse
#import" HelloPanoramaViewControl<wbr>ler.h"</wbr>#导入“HelloPanoramaViewControl<wbr>ler.h”</wbr>@implementation HelloPanoramaViewControl<wbr>ler</wbr>@执行HelloPanoramaViewControl<wbr>ler</wbr>@synthesize plView;@综合plView;// Implement viewDidLoad to do additional setup after loading the view, typically from a nib./ /执行viewDidLoad做额外的设置视图加载后,笔尖通常是从。- (void)viewDidLoad- ()viewDidLoad{{[super viewDidLoad];[超级viewDidLoad];// Example with Spherical type/ /球型的示例plView.isDeviceOrientationEnabl<wbr>ed = YES;</wbr>plView.isDeviceOrientationEnabl<wbr>ed =是;</wbr>plView.isAccelerometerEnabled = YES;plView.isAccelerometerEnabled =是;plView.isScrollingEnabled = YES;plView.isScrollingEnabled =是;plView.isInertiaEnabled = YES;plView.isInertiaEnabled =是;plView.type = PLViewTypeSpherical;plView.type = PLViewTypeSpherical;[plView addTextureAndRelease:[PLTexture textureWithPath:[[NSBundle mainBundle] pathForResource:@" pano"ofType:@" jpg"]]];[plView addTextureAndRelease:[PLTexture textureWithPath:[[NSBundle mainBundle]pathForResource:@“全景”ofType:@“jpg”的]]];}}- (void)dealloc- (无效)的dealloc{{[plView release];[plView新闻稿];[super dealloc];[超级的dealloc];}}@end@结束

6.6。plView variable pointing to the view in the resource file "MainWindow.xib"plView变量指向资源文件中的“MainWindow.xib文件”的观点

7.7。Add a resource image as "pano.jpg" this image must be Spherical for this example.新增为“pano.jpg”这个图片必须为这个例子球形资源的形象。

Classes Documentation类的文档

Then proceed to explain briefly the operation of the classes used:然后进行简单解释所使用的类的操作:

PLViewclass, this class is a view (inherits from UIView) allowing a simple set of features for power display panoramic images.PLView类,这个类是一个视图(UIView的继承),允许一个简单的全景图像显示设置功能的权力。The properties and methods of this class are:在这个类的属性和方法是:

  • BOOLisDeviceOrientationEnabl<wbr>ed</wbr>; //If the view allows you to enable orientation of the device supports (manually, typical of the Library)布尔isDeviceOrientationEnabl<wbr>ed;</wbr>/ /如果视图允许您启用设备方向的支持(手动,图书馆典型的)
  • UIDeviceOrientationdeviceOrientation; //lets see what orientation has this view, or set in that we want the view orientation appears.Eg.plView.deviceOrientation=UIDeviceOrientationLands<wbr>capeLeft;</wbr>UIDeviceOrientationdeviceOrientation;/ /让我们看看什么方向,有鉴于此,或设置,我们希望出现的视图方向=。UIDeviceOrientationLands<wbr>capeLeft<strong>例如。plView.deviceOrientation;</strong></wbr>
  • PLOrientationSupporteddeviceOrientationSupport<wbr>ed</wbr>;PLOrientationSupporteddeviceOrientationSupport<wbr>ed;</wbr><wbr></wbr>//This property allows you to tell the view that positions of orientation is enabled and running.Eg.PlView.deviceOrientationSupport<wbr>ed = (PLOrientationSupportedPo<wbr>rtrait | PLOrientationSupportedLa<wbr>ndscapeLeft) &lt;- in this case only allows for Portrait orientation and LandscapeLeft</wbr></wbr></wbr>/ /这个属性允许你告诉运行查看该职位方向是启用和和。LandscapeLeft例如。PlView.deviceOrientationSupport<wbr>ed</wbr>=(PLOrientationSupportedPo<wbr>rtrait | PLOrientationSupportedLa<wbr>ndscapeLeft)&lt; - “在这种情况下只允许纵向</wbr></wbr>
  • BOOLisAccelerometerEnabled; //This property enables the operation of the accelerometer布尔isAccelerometerEnabled;/ /此属性使加速度计的运作
  • BOOLisAccelerometerLeftRight<wbr>Enabled</wbr>; // This property activates the accelerometer operation only in the x-axis and depends on this active property isAccelerometerEnabled布尔isAccelerometerLeftRight<wbr>Enabled;</wbr>/ /此属性激活X轴加速度计操作只在和财产取决于这种积极isAccelerometerEnabled
  • BOOLisAccelerometerUpDownEna<wbr>bled</wbr>; // This property activates the accelerometer operation only in the y-axis and depends on this active property isAccelerometerEnabled布尔isAccelerometerUpDownEna<wbr>bled;</wbr>/ /此属性激活Y轴加速度计操作只在和财产取决于这种积极isAccelerometerEnabled
  • floataccelerometerSensitivity<wbr></wbr>; // Set the sensitivity with which to operate the accelerometer (motion sensing)accelerometerSensitivity<wbr>;</wbr>/ /设定灵敏度,用以经营加速度计(运动感应)
  • NSTimeIntervalaccelerometerInterva;l// Sets the refresh time in seconds of accelerometerNSTimeIntervalaccelerometerInterva;升/ /设置加速度计秒的时间刷新
  • CGPointstartPoint; // This property tells us which position he made the first touch when the event occurs (Touch Begin event)CGPoint起始点; / /此属性告诉我们他的立场所作的第一次触摸事件发生时(触摸开始事件)
  • CGPointendPoint; // This property will be cooling while moving the finger on the screen (Touch Move event)CGPoint端点; / /此属性将被屏冷却效果的同时移动手指(触控移动事件)
  • BOOLisScrollingEnabled; // This property tells us if you could make a scrolling at the hearing, if not active, only move when the fingers moving on the screen布尔isScrollingEnabled;/ /此属性告诉我们,如果你可以把在听证会滚动,如果不活跃,只有当手指移动屏幕上移动
  • NSUIntegerminDistanceToEnableScrol<wbr>ling</wbr>; // Minimum distance that must be traveled with the fingers to activate the scrollingNSUIntegerminDistanceToEnableScrol<wbr>ling</wbr>/ /最小距离,必须用手指走过来激活滚动
  • BOOLisInertiaEnabled; / / Check the inertia that means that when someone performs a scroll inertia is activated to slow the scroll to stop the movement布尔isInertiaEnabled;/ /检查的惯性,这意味着,当有人执行滚动惯性启动缓慢滚动停止运动
  • NSTimeIntervalinertiaInterval; // Duration of inertia in secondsNSTimeIntervalinertiaInterval/ /惯性持续时间以秒
  • BOOLisResetEnabled; // Property that can be enabled to reset the view to its original position when placing three fingers on the screen布尔isResetEnabled;/ /属性,可以启用重置查看其原始位置时,放置在屏幕三个手指
  • PLViewTypetype; // Type of view to be used can be (PLViewTypeSpherical, PLViewTypeCubeFaces, PLViewTypeCylindrical)PLViewType类型; / /类型PLViewTypeCylindrical)的角度来使用,可以(PLViewTypeSpherical,PLViewTypeCubeFaces,
  • PLCamera *camera; / / Property allows us to change or take the parameters of the cameraPLCamera *摄像头; / /属性允许我们改变或采取相机的参数
  • - (void)addTexture: (PLTexture *) texture; // Add a texture to be used, in the case of spherical and cylindrical single view to invoke this method once, in the case of cubic view use this method six times (one texture per face)- (空)addTexture:(PLTexture*)纹理; / /添加一个纹理用于查看,在三次的案件球形和圆柱形的单一视图援引这种方法一旦情况下,在使用此方法六次(一质地每面)
  • - (void)removeTexture: (PLTexture *) texture; // Removes an object of type texture of the view- (空)removeTexture:(PLTexture*)纹理; / /删除一个视图对象类型的纹理
  • - (void)removeTextureAtIndex: (NSUInteger) index; // Removes an object of type texture by index of the view- (空)removeTextureAtIndex:(NSUInteger)指数; / /删除由视图索引的一个纹理对象类型
  • - (void)removeAllTextures; // Removes all the textures that the view can use- (空)removeAllTextures;/ /删除所有的纹理,视图可以使用


PLTextureclass allows us to load a texture that will be used by the view, its properties and methods are:PLTexture类允许我们载入纹理,视图会被使用,其属性和方法是:

  • GLuinttextureId; // read-only property giving the identifier of an OpenGL textureGLuinttextureId;/ /只读属性赋予一个OpenGL纹理标识符
  • intwidth,height; // read-only properties for the width and height of a texture loaded诠释宽度高度; / /只读属性纹理的宽度和高度装一个
  • BOOLisValid; // Property to know if the texture failed to load布尔isValid的; / /属性知道如果纹理加载失败
  • - (id)init; // Default Constructor- (ID)的初始化/ /默认构造
  • - (id)initWithImage: (UIImage *) image; // Constructor that receives an object of type UIImage where an image must be loaded- (身份证)initWithImage:(UIImage*)图像; / /构造函数,接收一个UIImage对象的类型,其中必须加载的图像
  • - (id)initWithImage: (UIImage *) imagerotate(int) angle; // Same as the previous method but can rotate the image 90, 180, 270 degrees- (身份证)initWithImage:(UIImage*)图像旋转(int)的角度; / /方法以前一样,但可以旋转图像90,180,270度
  • - (id)initWithPath: (NSString *) path; // Constructor that receives the image path (jpeg, png)- (身份证)initWithPath:(的NSString *)路径/ /构造函数,接收图像的路径(JPEG格式,PNG等)
  • - (id)initWithPath: (NSString *) pathrotate(int) angle; // Same as the previous method but can rotate the image 90, 180, 270 degrees- (身份证)initWithPath:(的NSString *)路径旋转(int)的角度; / /方法以前一样,但可以旋转图像90,180,270度

// Constructors static type that operate with the same parameters that the init equivalent functions/ /构造静态类型具有相同的参数初始化操作的等效功能

  • + (id)textureWithImage: (UIImage *) image;+(ID)的textureWithImage:(UIImage*)图像;
  • + (id)textureWithPath: (NSString *) path;+(ID)的textureWithPath:(的NSString *)路径;
  • + (id)textureWithImage: (UIImage *) imagerotate(int) angle;+(ID)的textureWithImage:(UIImage*)图像旋转(int)的角度;
  • + (id)textureWithPath: (NSString *) pathrotate(int) angle;+(ID)的textureWithPath:(的NSString *)路径旋转(int)的角度;
  • - (BOOL)loadTextureWithImage: (UIImage *) image; // Load a texture from an image object- (布尔)loadTextureWithImage:(UIImage*)图像; / /加载一个对象从图像纹理
  • - (BOOL)loadTextureWithImage: (UIImage *) image rotate (int) angle; / / Same as the previous method but can rotate the image 90, 180, 270 degrees- (布尔)loadTextureWithImage:(UIImage*)图像旋转(int)的角度; / /方法以前一样,但可以旋转图像90,180,270度
  • - (BOOL)loadTextureWithPath: (NSString *) path, // Load a texture from image path (jpeg, png)- (布尔)loadTextureWithPath:(的NSString *)路径,/ /加载的路径纹理从图像(JPEG,PNG等)
  • - (BOOL)loadTextureWithPath: (NSString *) path rotate (int) angle; / / Same as the previous method but can rotate the image 90, 180, 270 degrees- (布尔)loadTextureWithPath:(的NSString *)路径旋转(int)的角度; / /方法以前一样,但可以旋转图像90,180,270度
720 Collapse
Eg.例如。PLTexture * texture =PLTexture *质地=[PLTexture textureWithPath:[[NSBundle mainBundle] pathForResource:@" pano"ofType:@" jpg"]];[PLTexture textureWithPath:[[NSBundle mainBundle]pathForResource:@“全景”ofType:@“jpg”的]];[plView addTexture:[PLTexture textureWithPath:texture]];[plView addTexture:[PLTexture textureWithPath:质地]];

PLCameraclass allows us to change the display settings of the hearing, their properties are:PLCamera类允许我们改变听证会的显示设置,它们的性质:

  • BOOLIsFovEnabled; // Enable zoom in or zoom outeg.plView.camera.isFovEnabled = NO;布尔IsFovEnabled;/允许放大或缩小,例如。/plView.camera.isFovEnabled =否;
  • floatfov; // zoom level for the Hearingeg.plView.camera.fov = 10;视野; / /缩放一级的听证10。plView.camera.fov=;
  • floatfovSensitivity; // sensitivity for the zoom when you place two fingers on the screeneg.plView.camera.fovSensitivity = 70;fovSensitivity;/灵敏度70变焦,例如当您在屏幕上的两个手指/。plView.camera.fovSensitivity=;
  • PLRangefovRange; // Range in values that will allow for the default zoom from -180 to 180eg.plView.camera.fovRange = PLRangeMake (-10.10);PLRangefovRange/ /范围值,将允许从默认-180放大到180例)。plView.camera.fovRange= PLRangeMake(-10.10;
  • PLRangefovFactorRange; // Range in which the zoom will work internaly (This range is for internal use with fovFactor property)PLRangefovFactorRange/ /变焦范围,其中将internaly(此范围为fovFactor财产内部使用)
  • BOOLisXAxisEnabled,isYAxisEnabled,isZAxisEnabled;布尔isXAxisEnabled,isYAxisEnabled,isZAxisEnabled;<wbr></wbr>// This properties enabled if the camera can move in the x, y, zeg.plView.camera.isXAxisEnabled = NO;/ /此属性中启用,如果摄像头可以在X Y运动,和Z没有。plView.camera.isXAxisEnabled=;
  • PLPositionposition; // property to place the camera in a position.PLPosition位置; / /属性放置摄像机的机位研究。PLPosition has the property x, y, zeg.plView.camera.x = 6;PLPosition拥有财产的x,Y,Z轴如6。plView.camera.x=;
  • PLRangexRange,yRange,zRange; // Define the range in which it can move in the x, y, zeg.plView.camera.xRange = PLRangeMake (-100, 100);PLRange的xrange,yRange,zRange;/定义的范围,它可以将在X,Y,Z轴例如。/plView.camera.xRange = PLRangeMake(-100,100);
  • BOOLisPitchEnabled,isYawEnabled,isRollEnabled; // These properties enable that axes can rotate the camera x, y, z eg.布尔isPitchEnabled,isYawEnabled,isRollEnabled;/ /这些特性使该轴可以旋转的摄像头的x,Y,Z轴例如。plView.camera.isPitchEnabled = NO;plView.camera.isPitchEnabled =否;
  • BOOLIsReverseRotation; // Enable the rotation of the camera displacement is inversely related to the user to do with the touch or accelerometer.Eg.plView.camera.isReverseRotation = YES;布尔IsReverseRotation;/ /允许的位移旋转的摄像头是负相关的用户做的触摸或加速度=。是例如。plView.camera.isReverseRotation;
  • PLRotationrotation; // angles of rotation (in degrees) of the camera x, y, zeg.plView.camera.rotation.pitch = 80;PLRotation旋转; / /旋转角度)的照相机(度的x,Y,Z轴例如80。plView.camera.rotation.pitch=;
  • PLRangepitchRange,yawRange,rollRange; // Range in which the camera can rotate in x, y, zeg.plView.camera.pitchRange=PLRangeMake (-90, 90); <- on the x axis can only rotate the angle - 90 to 90PLRangepitchRange,yawRange,rollRange;/ /范围,其中可旋转摄像头在X,Y,Z轴例如;。plView.camera.pitchRange =PLRangeMake(-90,90)< - “在X轴只能旋转角度- 90至90
  • floatrotateSensitivity; // value of sensitivity in which the camera will rotate when the user moves the view eg .rotateSensitivity;/ /灵敏度值,其中相机将轮流当用户移动的看法,例如。plView.camera.rotateSensitivity = 40;plView.camera.rotateSensitivity = 40;
  • - (void)reset; / / Lets reset the camera settings back to the original position of the cameraeg.[plView.camera reset];- (空)复位; /让]复位相机设置恢复到原来的位置plView.camera的重置/摄影机例如。[;
原文地址:http://blog.sina.com.cn/s/blog_7ccde1bf0100tp83.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值