PanoramaGL library類庫詳細解析
簡介
PanoramaGL library is the first open source library 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網路。
SVN and source code in http://code.google.com/p/panoramagl/ SVN和原始碼http://code.google.com/p/panoramagl/
Created by Javier Baez - Visit Ecuador Team建立者哈維爾貝茲 - 訪問厄瓜多隊
Important Note: Please add the credits in their projects when using the library. 重要提示:請加入他們的專案中使用時的學分庫。
Background背景
The supported features in version 0.1 Beta are: 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。 Import PanoramaGL 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"點選“+”中的“連結庫組”按鈕
- Click on "Add Other" button and find "PanoramaGL" project點選“新增其他”按鈕,找到“PanoramaGL”專案
- Select "PanoramaGL" folder, select "PanoramaGL.xcodeproj" file and click on "Add" button returning to "General" Tab"選擇“PanoramaGL”資料夾,選擇“PanoramaGL.xcodeproj”檔案和“新增”點選按鈕回到“常規”選項卡“
- Go to "Direct Dependencies" section and click on "+" button繼續“+”按鈕,“直接相關性”部分,然後點選
- Select "PanoramaGL" and click on "Add Target" button returning to "General" Tab選擇“PanoramaGL”,並點選“新增目標”按鈕返回到“常規”標籤
- Now go to "Build" Tab現在去“構建”標籤
- Find option "Header Search Paths" and double click on it.查詢選項“標題搜尋路徑”,並雙擊它。
- 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 option of "libPanoramaGL.a" on top-right panel as shown below:檢查“libPanoramaGL.a”的右上方皮膚如下圖所示的目標選擇:
3. 3。 In
the controller class HelloPanoramaViewController
must be implemented the code shown below:在控制器類HelloPanoramaViewController
必須執行下面的程式碼:
#import < UIKit/UIKit.h > #進口 <UIKit中/ UIKit.h> #import " PLView.h" #匯入“PLView.h”@interface HelloPanoramaViewController : UIViewController { @介面HelloPanoramaViewController:UIViewController { IBOutlet PLView * plView; IBOutlet PLView * plView; } } @property (nonatomic, retain) IBOutlet PLView *plView; @財產(非原子,保留)IBOutlet PLView * plView; @end @結束4. 4。 The view created must inherit from
PLView
, instead of UIView
, so it must be modified in the resource file HelloPanoramaViewController.xib .檢視建立必須繼承自PLView
的,而不是UIView
,所以它必須是HelloPanoramaViewController.xib修改資原始檔。5. 5。 In the controller class
HelloPanoramaViewController
must implement code in order to configure the view as shown below:在控制器類HelloPanoramaViewController
必須實現程式碼,以便配置檢視如下圖所示:#import " HelloPanoramaViewController.h" #匯入 “HelloPanoramaViewController.h”@implementation HelloPanoramaViewController @執行HelloPanoramaViewController@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.isDeviceOrientationEnabled = YES; plView.isDeviceOrientationEnabled =是;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:然後進行簡單解釋所使用的類的操作:
PLView
class, 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:在這個類的屬性和方法是:
- BOOL isDeviceOrientationEnabled ; //If the view allows you to enable orientation of the device supports (manually, typical of the Library)布林isDeviceOrientationEnabled; / /如果檢視允許您啟用裝置方向的支援(手動,圖書館典型的)
- UIDeviceOrientation deviceOrientation ; //lets see what orientation has this view, or set in that we want the view orientation appears. Eg.plView.deviceOrientation=UIDeviceOrientationLandscapeLeft; UIDeviceOrientationdeviceOrientation; / /讓我們看看什麼方向,有鑑於此,或設定,我們希望出現的檢視方向=。UIDeviceOrientationLandscapeLeft 例如。plView.deviceOrientation;
- PLOrientationSupported deviceOrientationSupported ; PLOrientationSupporteddeviceOrientationSupported; //This property allows you to tell the view that positions of orientation is enabled and running. Eg. PlView.deviceOrientationSupported = (PLOrientationSupportedPortrait | PLOrientationSupportedLandscapeLeft) <- in this case only allows for Portrait orientation and LandscapeLeft / /這個屬性允許你告訴執行檢視該職位方向是啟用和和。LandscapeLeft 例如。PlView.deviceOrientationSupported =(PLOrientationSupportedPortrait | PLOrientationSupportedLandscapeLeft)< - “在這種情況下只允許縱向
- BOOL isAccelerometerEnabled ; //This property enables the operation of the accelerometer布林isAccelerometerEnabled; / /此屬性使加速度計的運作
- BOOL isAccelerometerLeftRightEnabled ; // This property activates the accelerometer operation only in the x-axis and depends on this active property isAccelerometerEnabled布林isAccelerometerLeftRightEnabled; / /此屬性啟用X軸加速度計操作只在和財產取決於這種積極isAccelerometerEnabled
- BOOL isAccelerometerUpDownEnabled ; // This property activates the accelerometer operation only in the y-axis and depends on this active property isAccelerometerEnabled布林isAccelerometerUpDownEnabled; / /此屬性啟用Y軸加速度計操作只在和財產取決於這種積極isAccelerometerEnabled
- float accelerometerSensitivity ; // Set the sensitivity with which to operate the accelerometer (motion sensing)浮accelerometerSensitivity; / /設定靈敏度,用以經營加速度計(運動感應)
- NSTimeInterval accelerometerInterva ; l // Sets the refresh time in seconds of accelerometer NSTimeInterval accelerometerInterva;升 / /設定加速度計秒的時間重新整理
- CGPoint startPoint ; // This property tells us which position he made the first touch when the event occurs (Touch Begin event) CGPoint 起始點 ; / /此屬性告訴我們他的立場所作的第一次觸控事件發生時(觸控開始事件)
- CGPoint endPoint ; // This property will be cooling while moving the finger on the screen (Touch Move event) CGPoint 端點 ; / /此屬性將被屏冷卻效果的同時移動手指(觸控移動事件)
- BOOL isScrollingEnabled ; // 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; / /此屬性告訴我們,如果你可以把在聽證會滾動,如果不活躍,只有當手指移動螢幕上移動
- NSUInteger minDistanceToEnableScrolling ; // Minimum distance that must be traveled with the fingers to activate the scrolling NSUInteger minDistanceToEnableScrolling / /最小距離,必須用手指走過來啟用滾動
- BOOL isInertiaEnabled ; / / Check the inertia that means that when someone performs a scroll inertia is activated to slow the scroll to stop the movement布林isInertiaEnabled; / /檢查的慣性,這意味著,當有人執行滾動慣性啟動緩慢滾動停止運動
- NSTimeInterval inertiaInterval ; // Duration of inertia in seconds NSTimeIntervalinertiaInterval / /慣性持續時間以秒
- BOOL isResetEnabled ; // Property that can be enabled to reset the view to its original position when placing three fingers on the screen布林isResetEnabled; / /屬性,可以啟用重置檢視其原始位置時,放置在螢幕三個手指
- PLViewType type ; // 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; / /刪除所有的紋理,檢視可以使用
PLTexture class allows us to load a texture that will be used by the view,
its properties and methods are: PLTexture類允許我們載入紋理,檢視會被使用,其屬性和方法是:
- GLuint textureId ; // read-only property giving the identifier of an OpenGL texture GLuinttextureId; / /只讀屬性賦予一個OpenGL紋理識別符號
- int width , height ; // read-only properties for the width and height of a texture loaded詮釋寬度 , 高度 ; / /只讀屬性紋理的寬度和高度裝一個
- BOOL isValid ; // 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 *) image rotate (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 *) path rotate (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 *) image rotate (int) angle; +(ID)的textureWithImage:(UIImage *)影象旋轉 (int)的角度;
- + (id) textureWithPath : (NSString *) path rotate (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度
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:質地]];
PLCamera class allows us to change the display settings of the hearing, their properties are:PLCamera類允許我們改變聽證會的顯示設定,它們的性質:
- BOOL IsFovEnabled ; // Enable zoom in or zoom out eg. plView.camera.isFovEnabled = NO;布林IsFovEnabled; /允許放大或縮小,例如。/ plView.camera.isFovEnabled =否;
- float fov ; // zoom level for the Hearing eg. plView.camera.fov = 10;浮視野 ; / /縮放如一級的聽證10。plView.camera.fov =;
- float fovSensitivity ; // sensitivity for the zoom when you place two fingers on the screeneg. plView.camera.fovSensitivity = 70;浮fovSensitivity; /靈敏度70變焦,例如當您在螢幕上的兩個手指/。plView.camera.fovSensitivity =;
- PLRange fovRange ; // Range in values that will allow for the default zoom from -180 to 180eg. plView.camera.fovRange = PLRangeMake (-10.10); PLRange fovRange / /範圍值,將允許從預設-180放大到180 例)。plView.camera.fovRange = PLRangeMake(-10.10;
- PLRange fovFactorRange ; // Range in which the zoom will work internaly (This range is for internal use with fovFactor property) PLRange fovFactorRange / /變焦範圍,其中將internaly(此範圍為fovFactor財產內部使用)
- BOOL isXAxisEnabled , isYAxisEnabled , isZAxisEnabled ;布林isXAxisEnabled,isYAxisEnabled,isZAxisEnabled; // This properties enabled if the camera can move in the x, y, z eg. plView.camera.isXAxisEnabled = NO; / /此屬性中啟用,如果攝像頭可以在X Y運動,和Z 如沒有。plView.camera.isXAxisEnabled =;
- PLPosition position ; // property to place the camera in a position. PLPosition 位置 ; / /屬性放置攝像機的機位研究。 PLPosition has the property x, y, z eg. plView.camera.x = 6;PLPosition擁有財產的x,Y,Z軸如6。plView.camera.x =;
- PLRange xRange , 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);
- BOOL isPitchEnabled , 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 =否;
- BOOL IsReverseRotation ; // 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;
- PLRotation rotation ; // angles of rotation (in degrees) of the camera x, y, z eg.plView.camera.rotation.pitch = 80; PLRotation 旋轉 ; / /旋轉角度)的照相機(度的x,Y,Z軸例如80。plView.camera.rotation.pitch =;
- PLRange pitchRange , yawRange , rollRange ; // Range in which the camera can rotate in x, y, z eg. plView.camera.pitchRange = PLRangeMake (-90, 90); <- on the x axis can only rotate the angle - 90 to 90 PLRange pitchRange,yawRange,rollRange; / /範圍,其中可旋轉攝像頭在X,Y,Z軸例如;。plView.camera.pitchRange = PLRangeMake(-90,90)< - “在X軸只能旋轉角度- 90至90
- float rotateSensitivity ; // 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 camera eg. [plView.camera reset]; - (空) 復位 ; /讓]復位相機設定恢復到原來的位置plView.camera的重置/攝影機例如。[;
相關文章
- CoreLocation框架詳細解析框架
- Semaphore最詳細解析
- RxLifecycle詳細解析
- SAP BOM詳細解析
- Robot Framework自動化測試Selenium2Library庫詳細用法Framework
- MySQL:排序(filesort)詳細解析MySql排序
- scala模式匹配詳細解析模式
- mysql日誌詳細解析MySql
- ThinkPHP3.2公共類庫、應用類庫ThinkPHP/Library講解PHP
- dart類詳細講解Dart
- Android開發 - (介面卡)Adapter類中BaseAdapter實現類詳細解析AndroidAPT
- Android開發 - (介面卡)Adapter類中SimpleAdapter實現類詳細解析AndroidAPT
- 超詳細 DNS 協議解析DNS協議
- Hadoop Yarn框架詳細解析HadoopYarn框架
- MyBatis詳細原始碼解析(上篇)MyBatis原始碼
- 網址(URL)的詳細解析
- 詳細的AWR解析報告
- AFNetworking框架-詳細解析框架
- == 和 === 操作符詳細解析
- 【原始碼解析】- ArrayList原始碼解析,絕對詳細原始碼
- SAP 中利潤中心 詳細解析
- PE檔案格式詳細解析(一)
- Android UI——SpannableString詳細解析AndroidUI
- 超詳細SAP HANA JOB全解析
- linux命令yum的詳細解析Linux
- CountDownLatch、CyclicBarrier、Semaphore、Exchanger 的詳細解析CountDownLatch
- dnsmasq劫持和dns教程詳細解析DNS
- MySQL索引機制(詳細+原理+解析)MySql索引
- 超詳細的Eureka原始碼解析原始碼
- jquery.cookie.js用法詳細解析jQueryCookieJS
- JavaScript中依賴注入詳細解析JavaScript依賴注入
- pyhanlp 文字聚類詳細介紹HanLP聚類
- sqlHelper類的中文 詳細註釋SQL
- PE檔案格式詳細解析(二)--IAT
- 關於SAP clienyt copy詳細解析
- OpenIddict 登入及詳細流程解析
- 詳細解析DES系列加密技術(二)加密
- 使用廣播-BroadcastReceiver最詳細解析AST