DEVELOPMENT OF MARITIME RESCUE APPLICATION SYSTEM USING GEOGRAPHIC INFORMATION SYSTEM APPROACH NORFARIZA BINTI ZAINAL A thesis submitted in fulfilment of the requirements for the award of the degree of Master of Science (Hydrography) Faculty of Geoinformation and Real Estate Universiti Teknologi Malaysia FEBRUARY 2012 DEDICATION Especially To: My Family and beloved husband Thanks for all your love and support May God Bless iv ACKNOWLEDGEMENT First and foremost I would like to offer my sincerest gratitude to my supervisor, Prof. Dr. Hj. Mohd Razali bin Mahmud who has supported me throughout my research with his patience and guidance. Without him, this thesis would not have been completed or written. A special thanks to all my friends especially Anis, Ina, Wani, Mik and Siti Fatimah for all their help, support, interest and valuable advice. I would also like to thank the staffs at Hydrographic Research and Training Office (HRTO) for their help and supports in this study. Finally, I would like to thank my family members for supporting and encouraging me to pursue this master’s degree study. Without them, I could not have finished this study. Last but not least, I would like to give my special thanks to my husband, Sufian, whose patience and love have enabled me to complete this study. v ABSTRACT Nowadays, computer-based Geographic Information System technology is used in hydrographic process and retrieval of information. (GIS) This technology can be used in maritime rescue operations to access geographical data and information. Normally, the data obtained are in the form of nautical charts and hydrographic charts. With GIS technology, these data can be delivered in a suitable digital format. In this regard, a study towards the development of interactive maritime rescue application system and database development for nautical chart based on the GIS concept was developed for the Port of Pasir Gudang, Johor, Malaysia. The software used to develop the maritime rescue application system are ESRI MapObjects 2.4, ArcView 3.1, Microsoft Visual Basic 6.0 and Microsoft Access 2007. In addition, end-users can access and update information in the database from time to time in a cost-effective manner, if changes have been identified. Moreover, it can assist end-users to make queries such as locating vessels in danger areas and availability of nearby fire, rescue and medical services. vi ABSTRAK Pada masa kini, teknologi Sistem Maklumat Geografi (GIS) berasaskan komputer telah digunakan dalam proses hidrografi dan perolehan maklumat. Teknologi ini boleh digunakan dalam operasi penyelamatan maritim untuk akses data geografi dan maklumat. Umumnya, data-data yang diperolehi adalah di dalam bentuk carta nautika dan carta hidrografi. Dengan teknologi GIS, data-data ini dapat disampaikan dalam format digital yang sesuai. Sehubungan dengan ini, satu kajian ke arah pembangunan sistem aplikasi penyelamatan maritim secara interaktif dan pembangunan pangkalan data bagi carta nautika berdasarkan GIS telah dihasilkan. Perisian yang digunakan untuk membangunkan aplikasi system penyelamatan maritim adalah ESRI MapObjects 2.4, ArcView 3.1, Microsoft Visual Basic 6.0 dan Microsoft Access 2007. Data yang digunakan dalam kajian ini adalah untuk kawasan Pelabuhan Pasir Gudang, Johor, Malaysia. Di samping itu, pengguna juga dapat mengakses dan mengemaskini maklumat yang terdapat dalam pangkalan data dari semasa ke semasa secara kos efektif sekiranya terdapat sebarang perubahan yang dikenal pasti. Ia juga dapat membantu pengguna membuat pertanyaan seperti untuk mencari lokasi kapal di kawasan bahaya, perkhidmatan bomba, penyelamat dan perkhidmatan perubatan di kawasan yang terhampir. vii TABLE OF CONTENTS CHAPTER TITLE TITLE PAGE i DECLARATION ii DEDICATION iii ACKNOWLEDGEMENTS iv ABSTRACT v ABSTRAK vi TABLE OF CONTENTS 1 2 PAGE vii LIST OF TABLES x LIST OF FIGURES xi LIST OF ABBREVIATIONS xiv LIST OF APPENDICES xvi INTRODUCTION 1 1.1 Background 1 1.2 Problem Statement 3 1.3 Research Objectives 5 1.4 Research Scope 6 1.5 Research Significance and Benefits 7 1.6 Summary of the Thesis 8 LITERATURE REVIEW 9 2.1 9 Introduction viii 2.2 2.1.1 Raster Charts 11 2.1.2 Vector Charts 11 Electronic Chart 2.2.1 2.2.2 3 12 Electronic Chart Display and Information Systems (ECDIS) 13 Electronic Chart System (ECS) 14 2.3 GIS inHydrographyDataManagement 15 2.4 DatabaseDevelopment Process 17 2.5 Marine Spatial Data Infrastructure 19 2.6 Hydrographic Information System 21 2.7 Maritime Safety Information 22 2.8 Marine Search and Rescue 24 2.9 Global Maritime Distress and Safety System 25 2.10 Scripting Language 26 2.10.1 27 Microsoft Visual Basic 2.11 ESRI MapObjects 2.4 Overview 27 2.12 Summary 29 RESEARCH M ETHODOLOGY 30 3.1 Introduction 30 3.2 Preliminary Work 33 3.3 Data Collection 36 3.4 Software Exploration 37 3.5 Database Design 39 3.5.1 Conceptual DataModel 40 3.5.1.1 Entity Model 40 3.5.1.2 Relationship Model 41 3.5.1.3 Attribute 41 3.5.2 Logical Database Design 41 3.5.3 Physical Database Design 43 3.6 3.7 Development of Graphical Interface 43 3.6.1 43 Element of Graphical User Interface Development ofMaritime Rescue Application ix 3.8 3.9 4 System 44 Development ofM enu and Sub-Menu 47 3.8.1 File Menu 50 3.8.2 View Menu 52 3.8.3 Marine Search Menu 54 3.8.4 Help Menu 59 Summary RESULTS AND ANALYSIS 62 4.1 Introduction 62 4.2 Maritime Rescue Application System Display 62 4.3 System Evaluation 66 4.3.1 Testing the Map Tools Function 66 4.3.2 Testing of the Menu Bar Function 72 4.3.2.1 AddLayer 73 4.3.2.2 Remove Active Layer 74 4.3.2.3 Legend Editor 75 4.3.3 4.4 5 61 Evaluation ofMarine Search Menu 77 4.3.3.1 Vessel Location Menu 78 4.3.3.2 Medical Assisted Menu 83 4.3.3.3 Fire and Rescue Menu 85 Summary 86 CONCLUSION AND RECOMMENDATION 87 5.1 Introduction 87 5.2 Conclusion 87 5.3 Recommendations 89 REFERENCES 90-93 Appendices A - F 94-171 x LIST OF TABLES TABLE NO. TITLE PAGE 1.1 Hardware characteristics 6 1.2 Software characteristics 7 2.1 Types of Paper Chart 10 3.1 Example of representing ER Conceptual Model 40 3.2 Lists of Logical Design 42 4.1 Toolbar function 67 xi LIST OF FIGURES FIGURE NO. TITLE PAGE 1. 1 Search and Rescue areas 2 1.2 Search and Rescue areas in Malaysia 3 2.1 A simplified database system evironment (Source:Spatial with Database Application to GIS by Rigaux et,al., 2002) 2.2 19 A key principal of SDI is to publish data once and use many times (Source: IHO: Spatial Data Infrastructures “The Marine Dimension'\2009) 2.3 21 MapObjects and ActiveX containers (Source: ESRI, 1999) 28 3.1 Research methodology flowchart 32 3.2 Results of the survey on managing data using Web-based GIS application 3.3 Results ofM aritime Rescue Application System in the Marine Department 3.4 34 35 Results of the survey for maritime rescue information or data 36 3.5 Raster image of MAL 6128 37 3.6 Interface of Autodesk Map 2004 38 3.7 Interface of attribute data entry using ArcView 3.1 39 3.8 Entity Relationship Model 41 3.9 List ofComponent in Control Tab Menu 44 3.10 Map Control for MapObjects Visual Basic toolbox (Source: MapObjects, 2004) 45 3.11 Overall design of the system 46 3.12 Overall design of main the form 47 xii 3.13 Architectureof the Main and Sub-Menu 48 3.14 Menu editor Interface 49 3.15 Interface of Property Pages from Image Lists 50 3.16 Sub-menu in the File menu 50 3.17 Add CAD Layer dialog box 51 3.18 Symbol Properties interface layer 52 3.19 View menu 52 3.20 Icon of View menu in the tool bar 53 3.21 Interface of Identify Result 53 3.22 Marine Search menu 54 3.23 Interface ofVessel Locationwindow 55 3.24 Interface ofthe Vessel’s Location information 56 3.25 Workflow for linking Access Database to ADO 57 3.26 Interface of Medical Assisted list 58 3.27 Interface of Fire and Rescue list 59 3.28 Sub-menu of Help menu 60 3.29 Interface of About menu 60 3.30 Interface of Contact Us menu 61 4.1 Interface of main display 63 4.2 Interface of map display 64 4.3 Information of About menu 65 4.4 information of Contact Us menu 65 4.5 Zoom In interface 68 4.6 Zoom Out interface 69 4.7 Zoom Extent interface 70 4.8 Interface of identify results with the attribute of spatial data 71 4.9 Status Bar 72 4.10 Example of adding a layer to the map display 73 4.11 Example of a contour layer that is removed 74 4.12 Symbol Properties layer tab 75 4.13 Symbol Properties of the Lighthouse layer 76 xiii 4.14 The results after editing Lighthouse in Symbol Properties 76 4.15 Percentage of system evaluation 78 4.16 The ability of the system display vessel on the map 79 4.17 Interface ofVessel LocationMain window 79 4.18 The information about the vessel location 81 4.19 The example of the add and vessel information data 82 4.20 Injuries from mooring incident (Source: International Marine Contractor Association, Safety Flash, April 2009) 83 4.21 The information of Hospital list menu 84 4.22 The information of Fire andRescue menu 86 xiv LIST OF ABBREVIATIONS ADO - ActiveX Database Object AIS - Automatic Identifier System API - Application Programming Interface BASIC - Beginners All Purpose Symbolic Instruction Code CAD - Computer Aided Drawing CZM - Coastal Zone Management DAO - Database Active Object DBMS - Database Management System DGPS - Differential Global Positioning System ECDIS - Electronic Chart Display ECS - Electronic Chart System ENC - Electronic Navigational Chart EPIRB - Emergency Position-Indicating Radio Beacon ESRI - Environmental System Research Institute GIS - Geographic Information System GMDSS - Global Maritime Distress and Safety System GPS - Global Positioning System GUI - Graphical User Interface HIS - Hydrographic Information System HTML - Hypertext Markup Language IHO - International Hydrographic Organization IMO - International Marine Organization MMEA - Malaysian Maritim e Enforcement Agency MRCC - Maritime Rescue Coordinating Center MRSC - Maritime Rescue Sub-Center MRI - Marine Research Infrastructure xv MSRR - Malaysian Maritime Search and Rescue Region MSI - Maritime Safety Information MSDI - Marine Spatial Data Infrastructure NGDI - National Geospatial Infrastructure ODBC - Open Database Connectivity RMN - Royal Malaysian Navy SAR - Search and Rescue SDI - Spatial Data Infrastructure SENC - System Electronic Navigational Chart SOLAS - Safety of Life at Sea xvi LIST OF APPENDICES APPENDIX A TITLE PAGE List of Questionnaires for Development of Maritime Rescue Application System 94-96 B Entity Relationship Model 97 C Interface Programming Code D Form Programming Code 150-163 E Module Programming Code 164-169 F List ofFeedback Qouestionnaires for 98-149 Development Of Maritime Rescue Application System 170-171 CHAPTER 1 INTRODUCTION 1.1 Background Marine search and rescue (SAR) can be defined as the search for and provision of aid to people who are in distress or imminent danger. According to the International Convention on Maritime Search and Rescue, some areas have a wellestablished organization for search and rescue that is able to provide assistance promptly and efficiently but not all countries have such a organization. In 1979, the International Convention Maritime Search and Rescue aimed at developing an international SAR so that when an accident occurs, the rescue of persons in distress at sea will be co-ordinated by a SAR organization. The responsibilities of SAR Convention are: the parties of the convention are required to ensure that arrangements are made for the provision of adequate SAR services in their coastal waters; the parties follow the operating procedures of emergencies or alerts during SAR operation; the parties are required to establish ship reporting systems which enables the interval between the loss of contact with a vessel and the initiation of search operations to be reduced; and also to help permit the rapid determination of vessels which may be called upon to provide assistance, including medical help when required. Following the adoption of the 1979 SAR Convention, the International Maritime Organisation(IMO) Maritime Safety Committee divides the world's oceans into 13 search and rescue areas. Each of the countries concerned has delimited 2 search and rescue regions for which they are responsible. Figure 1.1 below shows the search and rescue areas. Figure 1.1 Search and Rescue areas (Source: International Convention on Maritime Search and Rescue, 1979) The search and rescue operation in Malaysia is operated by the Malaysian Maritime Enforcement Agency (MMEA). The responsibilities of MMEA in search and rescue tasks are detection of maritime incidents, coordination and control of maritime SAR operations within Malaysian areas, providing SAR resources to assist in humanitarian and civil incidents. MMEA has established a Maritime Rescue Coordinating Center (MRCC) and five sub-centers named Maritime Rescue Sub­ Centers (MRSC) for the purpose of coordinating search and rescue operations at sea in the Malaysian Maritime Search and Rescue Region (MSRR). The MRSC operation centre, established by MMEA to control and co­ ordinate Maritime SAR operations, is small in nature and requires only the facilities available within the region concerned. Each centre has its own area of responsibility. The MRSC established in Malaysia are located at Langkawi, Johor Bahru, Kuantan, Kuching and Kota Kinabalu. Malaysia. Figure 1.2 shows the search and rescue areas in 3 Figure 1.2 1.2 Search and Rescue areas in Malaysia Problem Statement Nautical charts are graphic representations of a maritime area that include information about the depth of water, obstructions and other dangers to navigation, and other features that are useful to the mariners. The nautical charts are essential tools for marine navigation and it may take the form of paper charts or Electronic Navigational Charts (ENC). According to the standards set up by International Hydrographic Organization (IHO) and the International Maritime Organization (IMO), Electronic Navigational Chart is a relatively new technology that provides significant benefits in terms of navigational safety and operational efficiency. More than simply a computer display, an electronic chart is a real-time navigation system that integrates a variety of information that are displayed and interpreted by the mariner. It is an automated decision aid capable of continuously determining a vessel's position in relation to land, charted objects, aids-to-navigation, and unseen hazards. 4 In practice, there is a system that is used for SAR, which is Global Maritime Distress Safety System (GMDSS). The basic concept of GMDSS is that search and rescue authorities ashore, as well as ships in the immediate vicinity of a ship in distress, can be rapidly alerted to the distress incident so that assistance can be provided in a coordinated search and rescue operation with minimum delay. The system also provides for urgency and safety alert and the broadcast of Maritime Safety Information (MSI), which are weather report and navigation warnings. Therefore, under SOLAS 1974 conventions, the GMDSS operation is divided into sea areas where it is defined by the governments and uses the criteria recommended by IMO. The GMDSS enables a ship in distress to send an alert using various radio systems. These systems are designed such that the alert has a very high probability ofbeing received by either shore rescue authorities or other vessels in the area. The advantage of this system is that it is an amalgam of various individual radio systems, both terrestrial and satellite. Although this system is equipped with high communication devices and technology, it still has a weakness where there is no facility of GMDSS in many areas of the world, including South Pacific nations. In addition, most vessels operating through many areas are not GMDSS equipped. Other than that, there are false alert problems in the GMDSS system. The root of this problem is the lack of practical experience of GMDSS equipment on board by trained personnel and improper use of GMDSS equipment by inadequately trained personnel. The system is focused on the use of radio communication from ship-ship and ship-shore and in SAR operations. Therefore, this research develops a maritime rescue application system based on the information contained in the nautical charts such as medical and fire and rescue assistance, depth, beacons, and others. The maritime rescue application system uses the Geographic Information System (GIS) approach where information is gathered and structured in a database. Therefore, in marine search and rescue operations, access to geographical data and information is vital to properly respond to an emergency or incident. The situation must be analyzed within the many dimensions such as the location of injured seamen on the ship, detection of overdue vessel, and others. To minimize the unexpected and unpredictable in emergency 5 management, it is necessary to gather and structure the information in a database for use in a risk assessment, or in a contingency or operational plan, and during an actual emergency response using the Geographic Information System (GIS) approach. Thus, the software that is used in this research is GIS software from ESRI (Environmental Systems Research Institute), which is MapObjects 2.4 to develop the system. ESRI MapObjects 2.4 is chosen because it allows the programmer to add dynamic mapping and Geographic Information System (GIS) capabilities to the existing Windows applications or to build custom mapping and GIS solution. 1.3 Research Objectives The specific objectives of this research are to: i. develop a Maritime Rescue Application System using the Geographical Information System (GIS) approach; design a database as a medium for collection, storage, and data processing for the purpose of maritime rescue application system; and analyze the results of the application based on the manipulations of the database. 6 1.4 Research Scope To ensure that this research is carried out effectively and achieves the objectives, the scope of this research is determined as follow: i. Data The research area is the Port of Pasir Gudang (MAL 6128) with the scale of 1:10 000. The represented chart needs to be converted into vector format, which is provided by the Royal Malaysian Navy (RMN). In order to develop the applications, the chart needs to be digitized into digital format. ii. H ardw are and Software Due to the highly interactive map, the characteristic or specification of the hardware must be of high performance. Table 1. 1 below shows the hardware characteristic of the system development: Table 1.1 Hardware characteristics Requirement Specification Memory / RAM 512 MB or 1GB (recommended) Hard disk 160 GB The softwares used for this research are Esri MapObjects 2.4, AutodeskMap 2004, ArcView3.1, Microsoft Access 2007, and Microsoft Visual Basic 6.0. The details are discussed in Chapter 3 and the characteristics of the softwares are shown in Table 1.2. 7 Table 1.2 Requirement Operating System Software characteristics Specification Microsoft Windows XP Professional 2002, SP 2 Softwares a) ESRI MapObjects 2.4 b) Microsoft Visual Basic 6.0 c) Autodesk Map 2004 d) ArcView 3.1 Database 1.5 Microsoft Access 2007 Research Significance and Benefits The significance of this research is to provide effective and efficient data management using GIS application and data distribution to the end-users. The integration of attribute and spatial data through digital medium such as a database, allows a user to analyze the logic or analyze the attribute and spatial data that are stored in a database. In addition, through the database development, it saves time, cost, and effort where the user can easily access the database. Furthermore, the information in the database can be updated by the user in an effective way. With the development of maritime rescue application system, an opportunity is provided for a better working environment, particularly to a navigator. In other words, this research benefits some organizations, such as the Royal Malaysian Navy, Marine Department, and others. 8 1.6 Summary of the Thesis There are five chapters in this research. The synopsis for each chapter is discussed below: i. C hapter 1 : This chapter explains the background of the research including the problem statements, purpose, objectives and scope of the research, significance and benefits of the research, and the research methodology. ii. C hapter 2 : This chapter explains the literature towards the development of a nautical chart to an electronic chart. The chapter also covers the research on marine and rescue, and the roles of GIS in hydrography. In addition, the software and scripting language are also discussed in this chapter. iii. C hapter 3 : This chapter explains the analysis of questionnaires, procedure of data preparation, database design, and development of a dynamic map. iv. C hapter 4 : This chapter focuses on the results and analysis of the marine rescue application system. v. C hapter 5 : This is the last chapter of this thesis. This chapter explains the conclusions and recommendations of the research. CHAPTER 2 LITERATURE REVIEW 2.1 Introduction Hydrography is the science of measurement of waters, currents, tidal and depth (Mohd Razali Mahmud, 2001). Bathymetry data that are obtained from the hydrographic survey are used to portray seabed areas for the condition of waters area through nautical charts and hydrographic plans. Nautical charts are produced for marine navigation. They contain information on all navigational aids, such as buoys and beacons, lighthouses, radio and radar stations, shipping channels, and restricted areas. Some charts are issued with Loran-C plotting grids or great circle sailing tracks. Water depths are recorded as soundings in metres, feet or fathoms. Near-shore depths are shown by contours and layered tints. In addition, physical features such as shorelines, shoals, reefs, submerged rocks, shipwrecks, kelp beds, and ocean bottom sediments are shown in detail. However, nautical charts are not primarily for their navigational information, but also to show coastal features and bathymetry. They can also serve as substitutes for street plans of coastal settlements and occasionally as general maps or topographic maps of coastal and island areas. There are five categories of paper charts: 10 Table 2.1 Types of Paper Chart (Source: Chartwork and Marine Navigation: For Fishermen and Boat Operators by Motte and Stout, 1990) Types of C hart • Descriptions World or General Chart - Small scale and shows important features, eg: sailing tracks. • • • • Offshore Chart Approach Chart Harbour Chart Other Charts - Small scale, eg: 1:3 000 000. - Used for offshore navigation - Large scale, eg: 1: 200 000. - Information in the chart shown in detail. - Large scale, eg: 1:20 000. - Suitable for harbour navigation. - Charts that are issued with Loran-C, Omega or Decca plotting grids or great circle sailing tracks. Due to the rapid development of technology, nautical charts available are printed on paper or as Electronic Navigational Charts (ENC), which use computer software and electronic databases to provide navigational information. An electronic navigational chart (ENC) is a vector-based digital file containing marine features suitable for marine navigation. It is based on the International Hydrographic Organization (IHO) S-57 standard. The ENC is intended for use in electronic charting systems (ECS) as well as Electronic Chart Display and Information Systems (ECDIS). ENCs can also be used in Geographic Information Systems (GIS) as base map data. The ENC boasts of electronic features that paper charts lack. For instance, a mariner can integrate global positioning system data, which tells a mariner his or her precise latitude and longitude with ENC data. The mariner can also integrate data 11 from real-time tide and current data, and wind data to enhance the capabilities of the ENC. Incorporating these features can create a fuller, more accurate picture of the marine environment. The electronic charting systems used to view ENCs can display warnings and regulations that pertain to areas in which a vessel transits, and can sound an alarm if the vessel's projected course veers too close to a dangerous feature. There are two main types of electronic charts, which are raster charts and vector charts. 2.1.1 Raster C harts Raster navigational charts are raster charts that conform to IHO specifications and are produced by converting paper charts to digital image by scanner. This raster chart applies to the graphic elements of the chart including symbols, lines, wording, and the chart borders. The colours of the displayed raster chart can be modified and need not be identical to those of the paper chart (Horanont et. al., 2002). Since the colour of the raster data can be changed, it is possible to produce colour sets during scanning to suit various light conditions on the symbol. 2.1.2 Vector Charts Vector charts are the chart databases for ECDIS, with standardized content, structure, and format, issued for use with ECDIS on the authority of government authorized Hydrographic Offices. ENCs are vector charts that conform to IHO specifications stated in Special Publication S-57. The process of graphic visualization for vector chart data is more complicated but flexible than the raster chart. While it is possible for raster chart to change the colours of the pixels from the original, the text and symbols remain the same as with 12 paper chart. This is not so with vector chart. In this case, the allocation of the graphic symbols is affected by the reading and interpretation of the data by computer software (Horanont et. al., 2002). A vector chart is independent of the original paper chart. In this process, the chart graphics of vector data are produced separately from the chart presentation and are not dependent on the print or scan quality. Although one would not suppose to do so for acceptance reasons, it is even possible to produce graphic symbology completely different from that of the traditional paper chart symbols (Cham Tau Chia, 2006). 2.2 Electronic C hart The electronic chart is a relatively new technology that provides significant benefits in terms of navigational safety and operational efficiency. More than simply a computer display, an electronic chart is a real-time navigation system that integrates a variety of information that are displayed and interpreted by the mariner. It is an automated decision aid capable of continuously determining a vessel's position in relation to land, charted objects, aids-to-navigation, and unseen hazards. The electronic chart represents an entirely new approach to maritime navigation (IHO, 2008). There are two basic types of electronic charts, those that comply with the (IMO) requirements for SOLAS class vessels, known as the Electronic Chart Display and Information System (ECDIS), and all other types of electronic charts, regarded generically as, Electronic Chart System (ECS). 13 2.2.1 Electronic C h art Display and Inform ation System (ECDIS) An Electronic Chart Display and Information System (ECDIS) is a specific form of computer-based navigation information system that complies with IMO regulations and used in lieu of paper navigation charts in some areas. Not all electronic chart systems can be called an ECDIS, but the term is often incorrectly used to refer to any type of Electronic Chart System (ECS). The true ECDIS system displays information from Electronic Navigational Chart (ENC) and integrates position information from the Global Positioning System (GPS) and other navigational sensors, such as radar, fathometer and Automatic Identification Systems (AIS). It may also display additional navigation-related information, such as Sailing Directions. The ENCs themselves are as important as the system that displays them. Again, confusion sometimes exists between official ENCs, which have to be produced by or on behalf of an international government Hydrographic Office, and other commercial electronic charts which, whilst they may be able to be displayed on an ECDIS system, do not comply with the IMO regulations for use as the primary navigational chart system. Only when official ENCs are run in a compliant ECDIS system can it be called as an ECDIS. All other chart data used immediately downgrades the system to an ECS, and non-compliant, under the terms of the SOLAS regulations for use of Electronic Charts, as a primary means of navigation for merchant shipping. This distinction is often over-looked by would be purchasers, but the legal fraternity may not be quite so ready to ignore the regulations. The ECDIS equipment is specified in the IMO ECDIS Performance Standards (IMO Resolution A.817 (19)) as follows: Electronic Chart Display and Information System (ECDIS) means a navigation information system which, with adequate back up arrangements, can be accepted as complying with the up-to-date chart required by regulation V/19 & V/27 of the 1974 SOLAS Convention, by displaying selected information from a System Electronic Navigational Chart (SENC) with positional information from navigation sensors to assist the mariner in 14 route planning and route monitoring, and by displaying additional navigation-related information, if required. The ECDIS is a ship borne navigational device and as such it is the responsibility of IMO. It must support the whole range of navigational functions that make use of the characteristics of the chart data and their specific presentation. Moreover, to be an ECDIS the equipment must be shown to meet all the requirements of the IMO Performance Standards (IMO Resolution A.817(19)) and offer, besides the graphic presentation of chart data, additional information about the characteristics of the displayed features. Within the ECDIS, the ENC database stores the chart information in the form of geographic objects represented by point, line and area shapes, carrying individual attributes, which make any of these objects unique. Appropriate mechanisms are built into the system to query the data, and then to use the obtained information to perform certain navigational functions, for example . the anti-grounding surveillance. The presentation of the current position, range/bearing functions and route planning capabilities are other examples of the minimum ECDIS requirements laid down in the IMO Performance Standards for ECDIS (ECDIS, 2008). 2.2.2 Electronic C hart Systems (ECS) Generally, all the systems that are not capable of meeting the ECDIS performance standards can be generically defined as Electronic Chart System (ECS). This can occur because they do not use the official ENC data that has been issued by a hydrographic office or they have limited functional capability that does not match the requirements specified by IMO. 15 The ECS that is using privately sourced data offers a good range of functionalities, several also display the official vector data and raster data. However, the private sources can only guarantee to a limited degree the completeness and correctness. They are not capable of being considered equivalent to nautical paper charts. However, this has not prevented the ECS from getting widespread acceptance and considerable success. Nowadays, the number of ECS equipped SOLAS vessels is much higher compared to the number of vessels carrying and operating an IMO compliant ECDIS. ECSs have firmly established the idea of using electronics charts display systems onboard. Truly, for legal reasons, the paper chart remains the official base for navigation onboard and cannot be left home for the vessel that operates with ECS (Cham Tau Chia, 2006). 2.3 GIS in Hydrography Data M anagement A Geographic Information Systems (GIS) is a system for capturing, storing, analyzing and managing data, which are spatially referenced to the earth. Until quite recently, most applications of GIS have focused on land based studies rather than marine environment. As in land based GIS application, Marine GIS application requires input in the form of a map of a water area (nautical chart or navigational chart). A GIS processes any data that has a spatial component. For hydrographic purposes, this information is quite diverse that it can be aerial photographs or satellite imagery, high resolution sonar data, multi-beam soundings, or LIDAR data. The use of GIS in the marine industry has been restricted in the past due to hardware and software limitations. The Environmental Systems Research Institute, Inc. (ESRI), recently completed research on an implementation of an object-oriented GIS data model (Geodatabase) and applications software (ArcGIS), which can currently support geodatabases implemented on Oracle 8, SQL Server, Informix, DB2, and Sybase. 16 Geodatabases are implemented directly on commercial relational or objectrelational database management systems so that it can efficiently store geographic data, produce maps, and perform spatial analytic tasks. The geodatabase has two major concepts. First, a geodatabase is a physical store for geographic information inside a DBMS. This is the natural solution for handling the growing amount of digital spatial data and also meets the need to leverage this data among the growing numbers of GIS users. The geodatabase supports multiple formats of spatial data including: i. Simple file features (such as shapefiles) ii. Custom features with business logic and editing rules iii. Attribute data iv. Metadata v. Images vi. Raster/Grid data vii. CAD data Second, a geodatabase has a data model that supports transactional views of the database (versioning) and also supports real-world objects with attributes and behavior (intelligent features). Behavior describes how an object can be edited and displayed. Versioning allows simultaneous editing by multiple users and also allows transacted views of the geographic database. The three key features of a geodatabase are: i. Centralized management of a wide variety of geographic information in a DBMS; ii. Versioning that allows simultaneous editing by multiple editors and transactional views of the geodatabase; and iii. Custom (or intelligent) features that have properties, behavior, and relationships. The Geodatabase offers the cartographer the ability to hold data within a seamless database. This is often referred to as a Master Feature Database (MFD). 17 Holding data within a seamless database holds benefits to both the cartographer and the end user. Units of work can be divided up into more logical work packages, not constrained by artificial chart boundaries. Operations, like edge matching, that is required when compiling charts using a sheet based system are eliminated. Data can be viewed in its true geographic state, that is a limited area that crosses a sheet edge is no longer split in two but can exist within the database as one feature. This reduces storage of duplicate attributes, eliminates the possibility of a mismatch in attributes, and enhances the information held within the database. Besides, a geodatabase is also accessible to an enterprise’s Internet or the world wide web can receive thousands or even millions of requests each day, and each request might apply the data to a completely different application. To manage such a load, “middleware” is needed between the geodatabase server and the web server connecting to it to the Internet such as an ArcIMS (Internet Mapping Server). The GIS technology advances over the past several years provide effective and efficient data management for processed hydrographic data. The geodatabase model lends itself well to database designs and applications associated with the collection, documentation, distribution, and analysis of large amounts of vector, raster, and surface modeling data. Using this approach provides the means of storing, analyzing, and modeling ocean data and enabling the existence of “intelligent data objects” and methods to distribute value added hard and soft copy products to end-users (Neal G. Millett and S. Evans, 2000). 2.4 Database Development Process Briefly, a database is a collection of data and relationships between data stored in secondary storage. In database development, data and information are two different things. In fact, data generally contains little information only, while the information is the result of data processing and contains three key elements such as 18 location, theme, and time. Thus, the questions of where, what, and when can be described clearly compared to the original data. The data in a computer database are managed and accessed through a database management system (DBMS), which allows users to deal with data without needing to know how the data are physically stored and structured in the computer. Generally speaking, a DBMS facilitates the process of: i. Defining a database: specifying the data types, structure, and constraint. ii. Constructing database: storing the data into persistent storage. iii. Manipulating the database. iv. Querying the database. v. Updating the database. Figure 2.1 shows the simplified database management system environment, which illustrates how a DBMS acts as a mediator between users or application programs and the devices where the data resides. 19 (Source: Spatial Databases with Application to GIS by Rigaux et,al., 2002) The database can be viewed in several different levels. The first is at the conceptual level that defines the data to be stored in the database. The second stage is the application of logical aspects. In logical aspects, it transforms the conceptual data model into a format understandable by a commercial DBMS. Finally, physical level deals with the data storage structure. 2.5 M arine Spatial Data Infrastructure Marine Spatial Data Infrastructure (MSDI) is the component of an SDI that encompasses marine geographic and business information in its widest sense. This would typically include seabed topography (bathymetry), geology, marine 20 infrastructure (e.g. wrecks, offshore installations, pipelines and cables), administrative and legal boundaries, and areas of conservation, marine habitats and oceanography. Spatial Data Infrastructure is a term used to summarise a range of activities, processes, relationships, and physical entities that, taken together, provide for integrated management of spatial data, information, and services. The term: i. Covers the processes that integrate technology, policies, criteria, standards, and people necessary to promote geospatial data sharing throughout all levels of the public sector; ii. Embraces the structure of working practices and relationships among data producers and users that facilitate data sharing and use. It covers the set of actions and new ways of accessing, sharing, and using geographic data that enable far more comprehensive analysis at all levels of government, the commercial and not-for-profit sectors, and academia; and iii. Describes the hardware, software, and system components necessary to support these processes. In order for the SDI to operate at its optimum level, minimum requirements in terms of data management will be required. Data Management probably includes inputs such as policy and plans necessary to deliver metadata, data sharing and exchange mechanisms, levels of data interoperability, network services including “discovery”, “view”, “download”, “invoke” and “transform” and other plans necessary to ensure compliance with SDI requirements (e.g. data licensing, digital rights management, pricing) (IHO: Spatial Data Infrastructures “The Marine Dimension”, 2009). Figure 2.2 shows the key principal of SDI. 21 r Mitts r» ;J-f LVSflBI ■ L l.'jrn i S p ila j- tjp rilii ■■ J t Tlwnitic frfos rr ta i fu n UIHLJ1 >.___________ / 1 - d .k U I'-ib ili ■■ J - Se'vk* Bus Gpr-enc 5er,icei iGeoRM layer) Qfcanrary HfVEM View HftlH x : _ OtjwiiHwl nnrvioa L O Z Eipnlial hala guts Figure 2.2 A key principal of SDI (publish data once and use many times) (Source: IHO: Spatial Data Infrastructures “The Marine Dimension”, 2009) 2.6 H ydrographic Inform ation System The initial objective of hydrography iss safe navigation of ships at sea and in connected waters. It is still its primary objective though its role has expanded considerably since the 1960s. Two processes primarily determine safety of navigation with reference to the chart, particularly in treacherous waters- one, speed of plotting successive ship’s positions on the chart by the mariner and two, speed of dissemination and incorporation of changes to the chart by the charting agency. The primary product under this application is a paper navigation chart depicting the coastline, ports and harbours, anchorages, depth contours, selected representative depths, navigational aids like lighthouses, buoys, wrecks and other underwater hazards, nature of sea bottom at intervals, tidal streams, and others Nowadays, the application of GIS, GPS and satellite communications allow for both the processes to be executed digitally in real time. hydrography and GIS The emergence of provide hydrographic products and services among hydrographic and oceanographic users such as administrators, oceanographers, and 22 engineers. This GIS can be a backbone for ocean related data in the larger National Geospatial Data Infrastructure (NGDI) (Mittal, 2002). There are a number of considerations that must be taken in order to improve marine navigation (e.g. weather, tidal, water depth, machinery damages, harmful obstructions, and others). With the existence of GIS technology, Hydrographic Information System (HIS) can integrate all the activities of a Hydrographic Office on a single integrated digital platform. In addition, it can be further integrated to oceanographic and topographical databases. Besides, to enhance the safety of navigation, GIS enables Hydrographic Offices to discharge its roles effectively in the fields of delineation of maritime boundaries and also Coastal Zone Management (CZM). The major applications of GIS in Hydrography are in processing of digital field data, preparation of electronic chart, and paper navigational charts (Mittal, 2002). The electronic chart is usually used as a base map for oceanic/coastal GIS domains. The electronic chart provides an enabling tool for building a comprehensive GIS enabled database for the oceanic and coastal domains. It also provides a base-map for the sea. Currently, the GIS trend is moving towards Web environment and it does bring more benefits for hydrography particularly in managing the electronic chart in a cost effective way (Cham Tau Chia, 2006). 2.7 M aritime Safety Information Maritime Safety Information (MSI) consists of navigational meteorological warnings and other urgent safety-related messages. and Particular navigational warnings contain information relevant to safe navigation such as: 23 i. Casualties and/or changes to Aids to Navigation including radio aids ii. Presence of dangerous wrecks iii. Presence of large unwieldy tows in congested waters iv. Drifting mines v. Areas where Search and Rescue operations are being carried out vi. Notices related to ships in distress, overdue, or missing ships vii. The presence of newly discovered rocks, shoals, reefs, and wrecks viii. Dangerous to navigation ix. Unexpected alteration or suspension of established routes x. Establishment of offshore structures xi. Cable or pipe-laying activities xii. Malfunctioning of radio navigational service and shore-based MSI xiii. Radio or satellite services xiv. Special operations e.g. naval exercises, nuclear tests xv. Acts of piracy and armed robbery against ships. The dissemination of MSI is achieved through an internationally coordinated network of broadcasts containing information necessary for safe navigation. A ship’s equipments automatically monitor a preset frequency and print out in English, information relevant to that ship. Coastal warnings are generally sent via NAVTEX, or in some NAVAREAs, by Inmarsat-C Enhanced Group Call (EGC) SafetyNET in lieu of NAVTEX; long range warnings are sent via Enhanced Group Call (EGC) SafetyNET service. Another kind of information relates to the control of and advice to ships which are navigating in difficult passage areas and are approaching or leaving port. This type of communication is optimized when a routing system is implemented. The International Maritime Organization and the IHO elaborate recommendations concerning Mariners' routing guides, giving full information on all aspects of the routing measures. It is to be noted that the SOLAS Convention establishes that Ships' routing systems are recommended for use by, and may be made mandatory for, all ships, certain categories of ships, or ships carrying certain cargoes, when adopted and implemented in accordance with the guidelines and criteria developed 24 by the IMO. Another element for improving maritime safety is the establishment and maintenance of a suitable number of navigational aids such as floating, fixed, and electronic (floating lights, lighthouses), and radio-navigational systems such as LORAN, GPS, DGPS, and beacons (International Hydrographic Bureau, 2010). 2.8 M arine Search and Rescue University of Aberdeen and MRI (Maritime Research International) conduct a research on interactive search and rescue system. The system is designed to integrate the geospatial technologies into an operational online Internet-based marine and coastal information system. According to Green and King (2003), the objectives of this research project is to facilitate greater and more interactive online access to geospatial data and information for the emergency search and rescue of end user community. It gives benefits to many people in the workplace with broadening access to geospatial data and information. For search and rescue missions, most often the first action to an emergency response is to establish the location of the incident (last known position). Many organisations require, at the outset, to get appropriate resources to the scene of the emergency or incident as quickly as possible. Therefore, the information of the incident must also be delivered to the rescue co-ordinators in a format that can be used on both a desktop PC (by planners and controllers), and in the field under mobile conditions (by operators and responders). Furthermore, the development of marine search and rescue system supports greater and more efficient and effective use of geospatial information in the context of emergency response, search, and rescue. 25 2.9 Global M aritime Distress and Safety System (GMDSS) The Global Maritim e Distress and Safety System (GMDSS) is an internationally agreed-upon set of safety procedures, types of equipment, and communication protocols used to increase safety and make it easier to rescue distressed ships, boats, and aircraft. The GMDSS is developed in 1988 by IMO to take advantage of modern communication technologies, especially satellite communications. It is an automated system designed to improve the dissemination and receipt of Maritime Safety Information, not only by ships at sea but also by pertinent shore based authorities equipped to render assistance to shipping. Furthermore, GMDSS in Malaysia is conducted by Malaysian Maritime Enforcement Agency (MMEA). GMDSS consists of several systems, some of which are new, but many of which are in operation for many years. The system is intended to perform the following functions: alerting (including position determination of the unit in distress), search and rescue coordination, locating (homing), maritime safety information broadcasts, general communications, and bridge-to-bridge communications. Specific radio carriage requirements depend upon the ship's area of operation, rather than its tonnage. The system also provides redundant means of distress alerting, and emergency sources of power. Under the GMDSS, all cargo ships of 300 gross registered tonnes and above and all passenger ships engaged on international voyages must be equipped with radio equipment that conforms to international standards as set out in the system. Statistics show that many incidents on GMDSS distress alert are false. The main reason for false distress alerts is improper use of the GMDSS equipment by untrained or inadequately trained personnel. They are probably also caused by the lack of practical experience of GMDSS equipment onboard ships by trained personnel. IMO issues guidelines on avoidance of false alerts and introduces a standard button design, which means that the distress button has to be protected and must be held down for at least 3 seconds to be activated. There are problems with equipment design and poor training. The Emergency Position-Indicating Radio Beacon 26 (EPIRB) has to be sensitive, because it has to be able to float free, and this sensitivity can sometimes lead to false alerts (MMEA, 2011). The main type of GMDSS equipment is Cospas-Sarsat. The Cospas-Sarsat is an international satellite-based search and rescue system, established by Canada, France, the United States, and Russia. These four countries jointly help to develop the 406 MHz Emergency Position-Indicating Radio Beacon (EPIRB), an element of the GMDSS designed to operate with Cospas-Sarsat system. These automatic- activating EPIRBs, now required on SOLAS ships, commercial fishing vessels, and all passenger ships, are designed to transmit to alert rescue coordination centers via the satellite system from anywhere in the world. The original COSPAS / SARSAT system uses Polar orbiting satellites but in recent years the system is expanded to also include 4 geostationary satellites. Newest designs incorporate GPS receivers to transmit highly accurate positions (within about 20 metres) of the distress position. The original COSPAS / SARSAT satellites can calculate EPIRB position to within about 3 nautical miles (5.6 km) by using Doppler Techniques. Furthermore, by the end of 2010, EPIRB manufacturers may be offering AIS (Automatic Identification System) enabled beacons. The service-ability of these items is checked monthly and annually and has limited battery shelf life between 2 to 5 years, using mostly Lithium type batteries. 406 MHz EPIRB transmits a registration number, which is linked to a database of information about the vessel (GMDSS, 2011). 2.10 Scripting Language A scripting language is a programming language that allows control of one or more software applications. "Scripts" are distinct from the core code of the application, which is usually written in a different language, and are often created or at least modified by the end-user. There are a number of scripting language types such as VBscript, ASP, Jscript, and others. 27 2.10.1 Microsoft Visual Basic The Microsoft Visual Basic programming language is based on BASIC (Beginners All Purpose Symbolic Instruction Code), a language designed by Kemeny and T Kurtz in the early 1960s. With Visual Basic programming, it allows data access features such as databases, front end applications, and scalable serverside components for database format, including Microsoft SQL Server. Apart from that, for the Internet use, Microsoft introduces Visual Basic Scripting Edition (VBScript). It is an Active Scripting language interpreted by Microsoft’s Windows Script Host. It brings active scripting to a wide variety of environments, including Web client scripting in Microsoft Internet Explorer and Web server scripting in Microsoft Internet Information Service. The language’s syntax reflects its pedigree as a variation of Microsoft’s Visual Basic programming language. Initially, it gains support from Windows administrators seeking an automation tool and first developed in the late 1970s. Currently, it is supported by Microsoft's Internet Explorer Web browser. VBScript is much simpler than Visual Basic programming language. In many ways, it is similar to JavaScript. It enables Web authors to include interactive controls, such as buttons and scrollbars, on their Web pages. In addition, VBScript can be also used to create stand-alone HTML applications, which require Internet Explorer 5 or later to run (Cham Tau Chia, 2006). 2.11 ESR IM apO bjects 2.4 Overview ESRI MapObjects is a set of mapping software components that lets the programmer to add dynamic mapping and geographic information system (GIS) capabilities to existing Windows applications or to build custom mapping and GIS solution. Figure 2.2 below shows the architecture of MapObjects. 28 Windows Operating System End user applications Visual Basic, Visual C++,Delphi,PowerBuidler VBA ESRI MapObjects Other custom ActiveX objects automation in Access, FoxPro,Excel, others Figure 2.3 MapObjects and ActiveX containers (Source:ESRI, 1999) From the figure above, it shows that ESRI MapObjects can run on Windows operating system and can use several programming environments such as Visual Basic, Visual C++ and others. In addition, Visual Basic, Visual C++, Delphi and Microsoft Access are examples of ActiveX containers and ActiveX servers. Within ActiveX container, it can combine objects from MapObjects and other custom controls to create customized enduser applications. Moreover, the functions of ESRI MapObjects are as listed below: i. Display map with multiple layers such as road, streams, and boundaries. ii. Pan and zoom throughout a map. iii. Find location on a map from a street address. iv. Identify features on a map by pointing to them. v. Query and update attribute data associated with selected features. Among the features in this software are: a) support data formats such as Standard, Format Computer-aided design (CAD) facilities; b) the path to the database via ActiveX Data Objects (ADO), Data Access Objects (DAO), and Open Database Connectivity (ODBC); and c) the image catalog in various formats such as GeoTIFF, TIFF, JPEG, GIF, ERDAS ®, and MrSID ™. This software also 29 facilitates data management where it has a filter spatial data and attributes. As an alternative to programming, the software also allows the Application Programming Interface (API) via ArcSDE application MapObjects. 2.12 Summary From this chapter, development of nautical charts are reviewed. It starts from raster chart to electronic chart (ECDIS,ECS and others). The nautical charts are produced to provide safe navigation along national and international territorial waters. Nowadays, hydrography is integrated with GIS for management, especially in marine search and rescue operation. efficient data Thus, with GIS approach, there are systems for marine search and rescue operation to reviewed such as GMDSS, interactive marine search and rescue, and others. However, to implement GIS application, MapObjects 2.4 is used as map display and Microsoft Visual Basic 6.0 is used as scripting language for this research. CHAPTER 3 RESEARCH M ETHODOLOGY 3.1 Introduction The methodology of this research is categorized into five phases. They are literature review, data preparation, database development, results and analysis, and conclusions and recommendations. The flowchart in Figure 3.1 clearly explains the methodology. i. L iterature Review : In this phase, literature review is done to get information on marine rescue. The information can be searched on the Internet, in magazines, journals, books, notes, and other sources. ii. Data Preparation : In order to develop the application, it is important to determine the software and also spatial and attribute data. Comparison among the softwares is needed in order to ensure that the softwares chosen are able to achieve the research objectives. In addition, the navigational maps are collected and digitized into vector format. iii. Database Development : In this phase, the data in a computer database are managed and accessed through a database management system (DBMS), which allows users to deal with the data without needing to know how the data are physically stored and structured in a computer. developed using Microsoft Access. The database is 31 iv. Result and Analysis : The analyzis of the system on marine rescue includes medical assistance, vessel location, and others. In this phase, the interpretation on spatial and attribute data analysis is based on the manipulation of the database. v. Conclusions and Recommendations : At this stage, the research on marine rescue application system is concluded to achieve the research objectives. The recommendations of this research are also included in this phase. 32 Figure 3.1 Research methodology flowchart 33 3.2 Prelim inary W ork In order to develop the application, an assessment is needed and is carried out on the related parties (Marine Departments). The purpose of the assessment is to ensure that the information in the application fulfills the needs of the users. There are 20 copies of questionnaires, which sre distributed to the Marine Departments in Malaysia. A set of questionnaires that is created is shown in Appendix A. By referring to the assessments , most of the staff are facing some problems such as lack of personnel and specialist in managing data using web based GIS, improper facilities, and data management in the department or organization. Figure 3.2, shows that 65% of the staff lack personnel for web-based GIS application. Therefore, it is important to build or develop a web-based GIS application to manage the maritime rescue data. 34 Result of the survey regarding W eb-Based GIS application in managing data Figure 3.2Results of the survey on managing data using Web-Based GIS application On the other hand, the results also show that they do not have maritime rescue application system in their departments. According to Figure 3.3, it shows that 40% of the respondents agree with having the system in their departments, which is not developed by them. The system that they use is the Global Maritime Distress and Safety System where they utilize this system for safety and SAR operations. 35 Result of the su rve y regarding Maritime Rescue Application System □ YES □ NO Figure 3.3 Result ofM aritime Rescue Application System in the Marine Department Moreover, Figure 3.4 shows a higher percentage of respondents agreeing regarding the information that a user needs in maritime rescue application system. The results show that 55% is for medical and fire rescue assistance, 30% for buoys/beacons, and 15% for marine department. Therefore, the information required in the maritime rescue application system is medical and fire rescue in which users can find information on medical assistance from the database. assistance that is needed is more to the on-site medical assistance. The medical 36 Result of the su rv e y regarding the inform ation o r data for maritim e rescue □ MEDICAL ■ MARINE DEPARTMENT □ BUOYS/BEACON 55% Figure 3.4 Results of the survey for maritime rescue information or data The results of the survey prove that there is no maritime rescue application system using GIS in the Marine Department. Therefore, this research leads to a developed maritime rescue application system using GIS approach. 3.3 Data Collection The data for this research is collected by using a nautical chart issued by the Royal Malaysian Navy (RMN). The nautical chart is a graphic representation of a maritime area and adjacent coastal regions. It shows the depths of water, natural features of the seabed, details of the coastline, navigational hazards, information on tides and currents, and others. Nautical chart MAL 6128 is chosen due to the study area, which is along the Port of Pasir Gudang. However, the chart needs to be converted into a vector format through the digitizing process. Figure 3.5 shows the raster image ofM AL 6128. 37 3.4 Software Exploration In this research, several softwares are needed in order to build the applications. The softwares used are Autodesk Map 2004, Arcview 3.1, ESRI MapObject 2.4, and Microsoft Visual Basic 6.0. These softwares are chosen based on the skills of the user and they are cost effective. The Autodesk Map 2004 software is used to digitize nautical chart in which the lines, points and polygons can be digitized easily compared to other GIS softwares. Figure 3.6 shows the digitizing process using Autodesk Map 2004. 38 |r >w»y, g p lh H I ■ _l'* a U IU W i fca b M M M i M P H a Hip i*t*:’ - - B O |iB *i ■i k <3 at t* m u ^ ' - I [■£* T----- S t 31---■>“ 01 . . *■4l -t ■ ..... _ . _________________________ __ r ^]U|)^' A - .■. ■■■ ._______________ !v ■■■ k ■■ ■ F_ 1" ' I Figure 3.6 11 '■ .. % ' Interface of Autodesk Map 2004 The ArcView 3.1 software is used for attributes data entry for spatial data that are processed by Autodesk Map 2004 software. Figure 3.7 shows the interface of attribute data entry using ArcView 3.1 software. 39 Figure 3.7 Interface of attribute data entry using ArcView 3.1 In addition, ESRI MapObjects 2.4 and Microsoft Visual Basic 6.0 softwares are implemented to develop the applications. ESRI MapObjects 2.4 is a set of mapping software component that has the capabilities to build custom mapping and GIS solution. The use of ESRI MapObjects 2.4 and Microsoft Visual Basic 6.0 provide flexibility for creating customized interfaces for maps. 3.5 Database Design The database design is the process of determining an appropriate database structure, for example deciding on the appropriate tables, attributes, and relationships. In this phase, there are some steps which are needed to be focused on such as conceptual data modelling, logical database design, and physical database design. 40 3.5.1 Conceptual Data Model In this phase, the conceptual data modelling uses all the required data for the system analysis and produces entity relationship diagrams (ERDs) for the conceptual schema. The entity relationship diagram is helpful in deciding the appropriate tables in a relational database. Moreover, the conceptual schema follows the rules of the Entity Relationship Model, which is a graphic representation that depicts things of interest (entities) and relationships among entities. relationships can both have attributes. Therefore, entities and Table 3.1 shows the example of an ER Conceptual Model. Table 3.1 Concept Example of representation of ER Conceptual Model Description Symbol Entity An element represents discrete data. Examples: map, building, chart, and others. Relationship o < — > Relationships connect two entities and they are related to one another. There are a number of relationships: - one to one (1:1) - one to many (1:m) - many to many (m:m) Attribute Attributes represent an elipse that is connected to their owning entity set. 3.5.1.1 Entity Model Entity is an element that represents discrete data. An entity may be a physical object such as building, map, chart, and others. rectangular shape. Entities are represented in a 41 3.5.1.2 Relationship Model A relationship connects two entities and relates one another. Relationships are represented in a diamond shape, connected by lines to each of the entity in the relationship. There are a few types of relationships: i) one to one; ii) one to many; and iii) many to many. Figure 3.8 below shows an example of the Entity Relationship Model. The figure shows that one to many relationship, which is a nautical chart, may have many depths and the details are shown in Appendix B. Figure 3.8 Entity Relationship Model 3.5.1.3 A ttribute Attribute is non-spatial information about a geographic feature in a GIS, usually stored in a table and linked to the feature by a unique identifier. For example, an attribute of a river might include its name, length, and sediment load at a gauging station. Attributes are drawn as ovals and are connected by a line to exactly one entity or relationship set. 3.5.2 Logical Database Design In the second phase, there is a Logical Database Design. The Logical Database Design is the stage where it is transformed from a Conceptual Data Model into a format understandable by a commercial DBMS. Usually, it produces a table design which includes tables, columns, primary keys, and other properties. 42 The software used to develop the database for this research is Microsoft Access 2007 due to the user friendly characteristic of the software. The table of structure design for the entity of Malaysia Charts in the Logical Design Phase is shown in Table 3.2. Table Name Malaysia C hart Table 3.2 A ttribute L isto f LogicalDesign Description Type of Data ID for charts ID Form at Text X (10) Scale Scale Number X(10) State State Text X(20) Coordinate Coordinate (X,Y) Number Name Name for charts Text X(10) ID ID for charts Text X(10) 999.999999 9.999999 Depths Area Area Text X(15) Value Value (Z) Number X(6) ID ID for charts Text X(10) Name Feature name Text X(20) Type Feature type Text X(10) Description Description Text X(150) ID for charts Text X(10) Colour Colour of lights Text X(6) Class Class of lights Text X(13) Type Type of lights Text X(10) Public Building Lights ID 43 Nature ID Colour Term 3.5.3 ID for charts Text X(10) Colour of nature Text X(15) Term of nature Text X(20) Physical Database Design The Physical Database Design is to define the storage level of a database system including the specification of data elements, data types, indexing options, and other parameters. However, if an improper design is made, it will influence the location of data and the performance of the overall system. 3.6 Development of G raphical Interface There are various kinds of graphical interface and each of them has its own function. An example is the Graphical User Interface (GUI). A GUI is a type of graphical user interface that allows people to interact with a computer. The purpose of the graphical interface development is to make it easier for a user to interact with the computer. 3.6.1 Element of G raphical User Interface The elements of graphical user interface are icon, menu, and windows. An icon is a small picture that represents an object such as a file, program, web page, or command. It is a quick way to execute commands, open documents, and run programs. Icons are also very useful when searching for an object in a browser list. 44 The window is an area on the screen that displays information, with its contents being displayed independently from the rest of the screen. 3.7 Development of M aritime Rescue Application System The standard EXE is selected and a form appears. After that, the right click mechanism on the toolbox (on the left toolbar) is used and Components menu is selected. In the control tab, there are several lists of the components and ESRI MapObjects 2.4, ESRI MapObjects Legend Control, and ESRI MapObjects Scalebar Control are searched for, as shown in Figure 3.9. Then, a new tool, which is a map control, legend, and scalebar is displayed on the Visual Basic toolbox. Figure 3.10 shows the map control from MapObjects displayed in the Visual Basic toolbox. C om ponents Controls | Designers ] Insertable Objects ] □ ComSnap 1.0 Type Library □ Controls 1.0 Type Library □ ctv OLE Control module □ DHTML Edit Control for IE5 □ DirectAnimation Library 0 E 5 R I MapObjects 2.-4 0 ESRI MapObjects Legend Control Te . ! a □ FlUpl Control Library CD Groove CalendarTool 1.0 Type Library □ Groove Client 1.0 Private Type Library □ Groove Common Components 1.0 Type Library □ Groove DataViewer Tool Type Library 1.0 Browse.. I Selected Items Only ESRI MapObjects Scalebar Control — Location: C\\. ..\Common F. .\ESRI\M021ScaleBar.ocx OK Figure 3.9 Cancel Apply List of Components in Control Tab menu 45 V is u a l B a sis m e n u and t o o lb a r rv ■Mo m HVHir^ G+w 0?+-jr.| bh e>** & c + m &- ' F>:<nu a y C stu j Ei.Lj'i ly + jj i I«4; iiiV r : frr d o v j tW p H fS*y T§F& lj “fta® 1 m a V lsuai B a s ic toaDooc w ith phi _i & ActiveX c o n tro ls M J Si 0 na d rd M a p c o n tra i a d d e d I d th e V s u a BasJc Cl Torm LJ 15 □ !g A 4 E — I U: 9 V is u a l B a s ic Tw m fT. n m Map control from MapObeets Figure 3.10 Map Control from MapObjects in Visual Basic toolbox (Source: MapObjects, 2004) The development of Maritime Rescue Application Systems consists of four main menus and each main menu contains a sub-menu. The main menus are File, View, Marine Search, and Help. Figure 3.11 shows the overall design of the system. However, the method used to produce the main menu display is in VB form format. There are 12 forms used for the entire system and three modules. Although there are 12 forms, only one form is used as the main form. Figure 3.12 shows the overall design of the main form. 46 Figure 3.11 Overall design of the system 47 E 3 iZ 3 M a ritim e R escue A p p lic a tio n System Menu Bar ' - <S 'i _ I f? _File _View_ Marine 5earch_ Hejg _ _ _ '3, ir Zoom In • Zoom Out Full Extent Pan Identify j Legend Exit Tool Bar ■ Map Display i j ■ l Image List Timer Map Figure 3.12 3.8 Overall design of the main form Development of Menu and Sub-Menu The menus allow the user to execute commands by allowing the user to select from a list of choices. The options are selected with a mouse or other pointing devices within a GUI. A keyboard may also be used. A menu has a visible title within the menu bar. Its contents are only revealed when the user selects it with a pointer. The user is then able to select the items within the pull-down menu. When the user clicks elsewhere, the contents of the menu disappear. 48 There are four main menus that are developed for this system and sub-menus for each main menu. Figure 3.13 indicates the architecture of the main menu and sub-menu. Zoom In Zoom Out View Zoom Extent Show Scale Bar Vessel Location About Help Marine Search Contact Us Figure 3.13 Medical Assisted Fire and Rescue Architecture of the Main Menu and Sub-Menu In order to produce the main menu, Menu Editor is used. The Menu Editor is a dialog box that can be accessed from the form window by pressing Ctrl+E or by selecting Tools | Menu Editor from Visual Basic’s menu bar. The Menu Editor can quickly and easily place the menu bar items into the application by pressing the command buttons and typing a few property values. The Menu Editor also contains menu description tools, which are to create the application’s menu bar, menu commands, and shortcut access keys. Figure 3.14 shows the menu editor interface. 49 M enu Editor OK Caption: [] Name: Cancel | mnuFile Index: Shortcut: HelpContextID: r~ [0 Checked [(None) NegotiatePosition: W Enabled ± 1*1 ± 1*1 &File " "A d d Layer... 11"Remove Active Layer ""Legend Editor -■■Exit StView ""Z o o m In ""Z o o m Out ""Z o o m Extent ""P a n Figure 3.14 Next Visible Insert |o - None r T | WindowList Delete Ctrl+A Ctrl+R Ctrl+L F3 Menu Editor interface The toolbar menu is produced using property pages from an image list that is available in the VB toolbox. The purpose of the image list is to insert pictures or symbols of the toolbar button. Figure 3.15 shows the interface of property pages of the image list. 50 P ro p e rty Pages Figure 3.15 3.8.1 Interface of Property Pages from the Image List File Menu There are four sub-menus in the File menu. The menus are Add Layer, Remove Active Layer, Legend Editor, and Exit, as shown in Figure 3.16. In order to produce the menu and sub-menu function, a programming language is required and the source code for this system is shown in Appendix C. r ---------------------------------------------------------------------------------------------------- * M aritim e Rescue A p p lica tio n System 9 View Marine Search Add Layer,.. Help Ctrl+A Remove Active Layer Ctrl+R Legend Editor Ctrl+L Exit F3 a Pan o Identify Exit Figure 3.16 Sub-Menu in the File menu i. Add Layer : The function of this menu is to add a data layer into the system. These systems support ESRI shape file format (*.shp), CAD file format (*.dxf, *.dwg), and standard image format (*.jpg, *.bmp, *.tiff, *.img, *.gif, *.sun, *.svg, *.dib, *.ras, *.gis, *.rs). A dialog box of Add CAD Layer is 51 displayed if the CAD file format is chosen. The purpose of Add CAD Layer is to allow the users to choose the feature types of CAD file format that can be added in a map. & A d d CAD La ye r Q - You have chosen to add____ CAD based map layer. ; Choose which feature types to add to your map. I ..........................Points ■ | 7 Lines [□ )[> < | ■■■ ; ; ; ................................... ................................... ..........................Polygons ................................... : : : : : : : : : : I- Text \\\\\\\\\\\\\ .................... ................................... Add Layers Now Figure 3.17 Add CAD Layer dialog box ii. Remove Active Layer : The function of this menu is to remove the Active Image Layer. iii. Exit : The function of this menu is to exit the application. iv. Legend Editor : The function of Legend Editor is to edit the Symbol Properties Layer. The Symbol Properties Layer consists of six items. These are Singles, Unique, Classes, Standard Label, Advance Label, and Elevation. The purposes of Symbol Properties Layer are to allow users to change or edit labels, symbols, colors, and other features for their map layers. Figure 3.18 shows the Symbol Properties Interface Layer. 52 La ye r S ym b o l P ro p e rtie s m La yer Name: The single sym bol classification displays all th e fe a tu re s in a la ye r w ith th e sam e symbol ■ ■ Classes Y S td labels ] A dv label Single U nique Color: [~ S tyle: |~ 5ize: |~ F o nt: |~ C h a ra c te r In d e x : T R o ta tio n : 0 : O utlin e Color 1 « i r ; A pply D raw Outlines? ► 1 . ■ f E levation ■ : ok ; Cancel : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Figure 3.18 3.8.2 Symbol Properties interface layer View Menu Figure 3.19 shows the View menu that consists of six sub-menus, which are basic functions that should be available in the systems. The sub-menus are Zoom In, Zoom Out, Full Extent, Pan, Identify, and Show Scale B ar functions. However, there is an option for users where they can select the icon of the View menu in the toolbar button as shown in Figure 3.20. •a M aritim e Rescue A p p lica tio n System File 1 Marine Search c Zoo 117 [ Help Zoom In 1 Zoom Out xtent n Pan o Identify Zoom Extent Pan Identify F L i/ 5how Scale Bar Figure 3.19 View menu m Exit 53 Zoom In cc Zoom Out « Full Extent Pan o Identify Figure 3.20 Icon of View menu in the tool bar i. Zoom In : The function of Zoom In is to view the map in large scale. ii. Zoom Out : The function of this menu is to resize the map. iii. Full Extent : The function of this menu is to refresh the map with the actual size. iv. Pan : The function of this menu is to navigate the map v. Identify : The function of this menu is to identify the spatial data with their attribute of the map. Figure 3.21 shows the interface to Identify Result. Figure 3.21 Interface of Identify Result 54 vi. 3.8.3 Show Scale B ar : The function of this menu is to show the scale of the map. M arine Search Menu Figure 3.22 shows the sub-menus on Marine Search, which are Vessel's Position, Medical Assisted, and Fire and Rescue. The main purpose of the sub­ menu for Vessel's Position is to display the positions of a vessel on the map. The coordinate used is in WGS84. The Vessel Position menu consists of two interfaces. These are vessel location main window form and vessel location information form. Figure 3.23 illustrates the interface of vessel location main window form. The main form consists of four command buttons. These are: i. Add Vessel : Displays the vessel’s location information form with empty text boxes. ii. Remove V essel: Removes the selected vessel’s name in the list box. iii. Display Vessel : Displays the vessel’s information data for the selected vessel displayed in the text boxes. iv. Exit : Exits the vessel’s location main window form. « M aritim e Rescue A p p lic a tio n System File Vi. Zoom In Marine Search Help Vessel Position o medical assisted Pan O <® Identify Exit Fire and Rescue Figure 3.22 Marine Search menu 55 § Vessel Location Main (^ ] IstVessel A d d V essel R e m o v e V e sse l D isplay V essel Exit Figure 3.23 Interface ofVessel Location window In addition, vessel location information menu consists of date, a vessel's name, the vessel's type, captain’s name and the number of crew members on board so that the user can use it as a navigation record. Figure 3.24 illustrates the interface of vessel location information. It shows four command buttons which are: i. Display V essel: Displays the vessel on the map. ii. Delete V essel: Deletes the selected vessel on the map. iii. Hide V essel: Hides the selected vessel on the map. iv. OK : When the user clicks on the OK button, the current vessel’s information data is saved. v. C an ce l: Cancels the operation. 56 *i Vessel's Location V e sse l In f o r m a tio n Vessel's Name: |~~ Type of Vessel: |~~ Display Vessel Captain's Name: Delete Vessel Crew members: Hide Vessel Date: J~~ Calendar... Cancel V e sse l's P o sitio n : X= r Ok - r X:Between 103.600 and 104.600 Y: Between 1.300 and 1.450 Figure 3.24 Interface of the Vessel's Location window In order to develop the sub-menu of Medical Assisted and Fire and Rescue, the ActiveX Data Object (ADO) in a VB module is used to link the database from Access. The database format is in .mdb format. linking Access database to ADO. Figure 3.25 shows the steps of 57 I'rnpfcJj IM y i ^ : l t r K n r- R i e h J ^ h x i ! C cta | i t t 50U»(I&»»«Wi ' UwDnLHFfc I J *UiiCcmLfcnli-mj F iH i k i 4 4 E n i E l J il UL[ Lti 4 H i 41 f l irt llitcd H+ Step 1 Step 2 ^ D a ta L ink P r o p e r tie s P ro v id e r C o n n e c tio n | A d v a n c e d | All S p e c if^ h ^ o llo w in ^ t^ c o n n g c ^ ^ A c c e s ^ d a ta : S e le c t or ente r a d a ta b a s e n a m e : 2 . E n te r inform ation to lo g c i to th e d a ta b a s e : U s e r n a m e . [A d m in P a s s w o rd : J B la n k p a s s w o rd f A llo w s a v in g p a s s w o rd T e s t C o n n e c tio n Step 3 Figure 3.25 Workflow for linking Access Database to ADO The first step in Figure 3.25 is to select the Connection String property on the builder button. The second step is to select the Microsoft Jet 4.0 OLE DB Provider in Data Link Properties dialog box. The third step is to select or enter a Database Name. The final step is to select the test connection button to ensure that the database is connected to ADO. When the connection is successful, it shows that the database is already linked to ADO. Therefore, the results of the database can be viewed in VB form as shown in Figures 3.26 and 3.27. The programming code for database results is shown in Appendix D. Both figures show five command buttons which are: 58 i. Add : To add new data or information in the text boxes. ii. Save : To save the new information that are filled in the boxes. iii. Previous: Shows the previous information or data in the lists. iv. N e x t: Shows the next information or data in the lists. v. Close : To terminate the application. Si Medical Asssited Name Address State Citji Zip Code Add Contact Save Previous Figure 3.26 Newt Close Interface of Medical Assisted list 59 A Fire and Rescue List of Fire and Rescue Address State Poscode City Add Contact Save Next Figure 3.27 Previous Close Interface of Fire and Rescue list 3.8.4 Help Menu The sub-menus of Help are Contact Us... and About... menus as shown in Figure 3.28. The About... menu consists of the explanation of the systems and the Contact Us... menu shows the details of marine department such as address, telephone number, and e-mail. Figures 3.29 and 3.30 show the interface of About... and Contact Us... menus. 60 M aritim e Rescue A p p lic a tion System File View ^ Marine Search a Zoom In Zoom Out Full E Figure 3.28 Help Contact Us..., 0 <® About.... sntify E x it Sub-menu of Help menu A b o u t M a ritim e R e s c u e A p p lic a tio n ® Maritime Rescue Application Systems Copyright 2007-2010 Maritime Rescue Application System is a search and rescue system that cooperation in Johor Bahru area.These system search the nearest locations for medical assisted such as paramedics, ambulance and others. This system was created to fulfill the requirements to be granted a Master Degree In Hydrography from Universiti Teknologi Malaysia. Warning:This computer program is protected by copyright law. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible law. □K Figure 3.29 Interface of About menu 61 E . Contact Us ( C o n t a c t us Address: Johor Port Authority, P.O Box 151, 81700, Johor Bahru ;V " — f '% P h o n e :0 7 -2 2 4 8 0 9 3 Fax : 07-2248092 Email :mfSC_johoi@maiine.gov.my I______________________________________________________ Figure 3.30 3.9 Interface of Contact Us menu Summary This chapter discusses the various aspects of research methodology where it is divided into several phases starting with research planning, literature review, data collection, development of GIS database, and the system. All these phases are discussed clearly in order to produce an interactive and user friendly system. In this research, the entire system is developed using ESRI MapObjects 2.4 and Microsoft Visual Basic 6.0 softwares. CHAPTER 4 RESULTS AND ANALYSIS 4.1 Introduction The objective of this research is to design and develop a maritime rescue application system based on Geographic Information System (GIS) Technology. The concept of this system is interactive and user friendly where the user can access the spatial information at any time. Thus, to develop the system, a database and interface of the system are developed. Therefore, the interface of the system is developed using Microsoft Visual Basic 6.0, MapObjects 2.4, ArcView 3.1, and Microsoft Access 2007 softwares. In this chapter, the evaluation and testing are discussed to ensure that the system is more interactive and user friendly. 4.2 M aritime Rescue Application System Display The Maritime Rescue Application System can give spatial information to the users besides attribute information for each spatial layer. In addition, this system allows the information to be accessed at anytime by the user. In this system, the user is able to see a main display, which shows three menus, namely Main, About, and Contact, as shown in Figure 4.1. The user can also activate the menus from the main display according to hi needs. In this system, 63 the main menu displays spatial information such as depth, contour, and others as shown in Figure 4.2. The About... menu shows the explanation of the system and for the Contact Us... menu, it shows the contact details of Marine Departments. Both menus are shown in Figures 4.3 and 4.4. Figure 4.1 Interface of the main display 64 •i M aritim e Rescue A pplication System File View Marine Search ^ Zoom In Help <* » Zoom Out Fulf Extent 17 DEPTH 17 CONTOUR y 17 LIGHTHOUSE □ 17 LIGHTHOUSE.GREEN □ 17 UGHTH0USE_YE110W □ 17 UGHTHOUSE_RED ■ 17 BUILDING □ □ 17 FIRE BRIGADE 17 SWAMP X: 103.90 Y:1.39 Figure 4.2 Interface o f the Map display 65 A b o u t M a r i t i m e R e s c u e A p p lic a t io n ® Maritime Rescue Application Systems Copyright 2007-2009 Maritime Rescue Application System is a search and rescue system that cooperation in Johor Bahru area.These system search the nearest locations for medical assisted such as paramedics, ambulance and others. This system was created to fulfill the requirements to be granted a Master Degree In Hydrographic Survey from Universiti Teknologi Malaysia. W arning:This computer program is protected by copyright law. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible law. OK Figure 4.3 Information of the About menu c o n ta c t us Address: Johor Port Authority, P.O Box 151, 81700, Johor Bahru Phone: 07- 2248093 Fa:-; : 07-2248092 Email Figure 4.4 :mrsc_johor@marine.gov.my Information of the Contact Us menu 66 4.3 System Evaluation In this part, the system is tested to determine the effectiveness of the function, which resides in this system. The evaluation of the system is divided into two and these are: i. Testing the Map Tools and Menu Bar function; and ii. Evaluation of the effectiveness of Marine Search menu function. 4.3.1 Testing the M ap Tools Function The testing of the system is based on the map tools functions. The functions of the map tools are toolbar and menu bar buttons. The toolbar buttons consist of Zoom In, Zoom Out, Full Extent, Pan, Identify, and Exit button, as shown in Table 4.1. These are the shortcuts for users, which make their jobs easier and Figures 4.5 to 4.8 show the graphics of the toolbar functions. 67 Table 4.1 Toolbar functions To enlarge the map for a better view. q Zoom Out the map for smaller view. Shows the entire map with all the details. * To navigate the map around within the m map window. -■"H1 To identify spatial data with the attribute 0 of the map. Identity To exit the application. The shortcut key is Ex* F3. 68 Figure 4.5 Zoom In interface 69 M aritim e Rescue A p plicatio n System File View Marine Search .Q: Zoom In Help 9 Zoom Out Full Extent DEPTH LIGHTHOUSE □ [7 LIGHTHOUSE.GREEN □ 17 LIGHTHOUSE.YELLOW □ [7 LIGHTHOUSE.RED ■ [7 BUILDING 17 FIRE BRIGADE □ W CONTOUR A 17 SWAMP Figure 4.6 Zoom Out interface 70 H E® ■i M aritim e Rescue A pplication System File View ^ Zoom In Marine Search Help Cc » Zoom Out Full Extent Pan 0 <0 Identify Exit [7 DEPTH [7 LIGHTHOUSE □ 17 UGHTHOUSEJ3REEN □ 17 LIGHTHOUSE_YELLOW □ 17 UGHTHOUSE.RED a 17 BUILDING [7 FIRE BRIGADE n [7 CONTOUR M 17 SWAMP Figure 4.7 Zoom Extent interface 71 i Id e n tify Results :ation: (103.86351205253,1.4564001810694) features found Attributes: LATITUDE = 1.456 CHART_ID = MAL 6128 DEPTH_ID = 1026 Featureld = 10 15 LONGITUDE = 103.864 DEPTH_Z = 1 5 .9 Theme: depth Shape Type: Point f ° • i s ______ a . - _ Figure 4.8 Interface to Identify Results with the attribute of spatial data Figure 4.8 shows the interface to identify results, which shows spatial data with the attribute of the map. In Figure 4.8, it shows that the depth value of the designated chart is 15.9 m with the Latitude of1.456 N and Longitude of103.864 E. Besides that, there is a status bar below the map display. It shows the coordinate, scale, time, and MapTips of the map. The value of scale changes if the user uses the zoom function, as shown in Figures 4.5 to 4.7. The MapTips function is similar to Identify Results, which shows the information of the spatial data. The difference between MapTips and Identify Results is that the MapTips shows specific information according to the user’s need. Figure 4.9 shows the interface of status bar and an example of the MapTips function. From Figure 4.9, the MapTips is selected and the description of a red lighthouse is chosen. When the user points to the red lighthouse, it shows a single flash in 3 seconds. The function of the lighthouse is to serve as a navigational aid to ships by sending a beam of light, which provides signals. 72 Figure 4.9 4.3.2 Status Bar Testing of the M enu B ar Function The menu bar function is tested on the File menu. The File menu consists of Add Layer, Remove Active Layer, Legend Editor and Exit. 4.3.2.1 Add Layer The function of the Add Layer is to add a layer in the map display. The file formats that are supported by this system are ESRI shape file format (*.shp), CAD file format (*.dxf, *.dwg), and standard image format (*.jpg, *.bmp, *.tiff, *.img, 73 *.gif, *.sun, *.svg, *.dib, *.ras, *.gis, *.rs). The users have two options in order to add the layer. First, the user can select the Add Layer on the File menu options or the user can use the shortcut key (Ctrl+A) by pressing on the keyboard. When the user selects the Add Layer, the selected file for a new layer interface appears and the user can choose a layer that he wants to add to the map display, as shown in Figure 4.10. S e le c t f ile fo r n e w la y e r |o ' My R ecent Docum ents ■3 iw l building ifrrl village ifrrl co n to u r sh^ d£] d e p th iwl w a te r je s s deep «hV| fire _ b rig a d e IS c?- on* w a te r_ d e e p w a te r_ s h a llo w sh’pI 3 D e s k to p land lighthouse I. *;|lighthouse_green H jw | lighth o u se _re d Jh£| lighthouse_ye llow My D ocum ents w l m arine dp S ) oil j ® road 5hp1 swamp My Computer File name: " 4 M aritim e K csc [lighthouse_ O pen JESRI Shapefiles (x shp) M y N etw ork P laces f” O pen as read-only A p p lic a tio n S y sten Figure 4.10 Example of adding a layer to the map display 74 4.3.2.2 Remove Active Layer The function of Remove Active Layer is to remove the active layer image. The user has two options in order to remove the active layer. First, the user can select Remove Active Layer on the File menu options. Otherwise, the user can use the shortcut key (Ctrl+R) by pressing on the keyboard. Figure 4.11 shows the difference before and after the layer is removed. From Figure 4.11, the layer that is been removed is a contour layer. Figure 4.11 Example of a contour layer that is removed 75 4.3.2.3 Legend Editor The Legend Editor allows users to change or edit symbol properties layer such as labels, colours, symbols and other features in the map layers. The symbol properties layer consists of six items. The items are Singles, Unique, Classes, Standard Label, Adv Label and Elevation. Figure 4.12 shows the symbol properties layer tabs. Single Unique Figure 4.12 Classes 5td labels Adv label Elevation Symbol Properties layer tab In addition, the user has two options in selecting the Legend Editor menu, which are either selecting Legend Editor on the File menu options or using a shortcut key (Ctrl+L) by pressing on the keyboard. Figure 4.13 shows the example of the lighthouse editing from the symbol properties layer, where it uses single and adv label items. The Single menu allows the user to change color, size, and shape of the spatial data. Meanwhile, the Adv label menu allows the user to label the symbol or spatial data in the map, as shown in Figure 4.14. 76 « S'lffl-Qol (jii^'LillLk for Ik'scUti-trilUUSI l2.ytr •V ‘.fTT.ini ppspnrlirr Inf jfcn L H fffiQ U H l«3pt« Lm ii T im Rh ! f ^ S'irtid dairivtJE-Ti-lipU yi * lt t n Ii *1l i i i r. i Ltyii vijh ih w e f lT h il W m ft | The- to QwriBctfcQLBtefe toS atta *»«*«:* !(■ smdfed h-ri-d «rd M « A i ba i i b 4 v4 E-vailic-c-ni n d L >riy | | SU U-ita | M t U til | G iim i K WM '[ oww I v.l SS2SI3S H5* On h!«riU ii _*J “ J LSM h»$0KSI H pU lH Flu i n !'" Flui rtiavi PlKlb^M 3 J Of Figure 4.13 i < ~ jJ * ->*H Symbol Properties of the Lighthouse layer M aritim e Rescue A pplication System Figure 4.14 f _ l f J W t ' AfewAjfcdlii ' Hiir U:*h RSKl____ j | j « rats '[Aii, .1:1- I r □iM'h-artu'-ai T«.r IfeU N rti c l Iriadi. B I D 1*1 The results after editing the Lighthouse layer in the Symbol Properties 77 4.3.3 Evaluation of Marine Search Menu In this part, this system is tested on Marine Search menu. The sub-menus consist of Vessel Position, which records the vessel location, vessel type, date, captain’s name, and number of crew members on-board and Medical Assisted and Fire and Rescue Assisted menus, which record the location, address, and state. These three sub-menus are used for the purpose of planning, searching and rescuing, and providing navigating assistance. In testing the application, some problems may occur such as certain functions not running well or users are dissatisfied with the interfaces. Therefore, the system is re-tested and re-evaluated if needed. The feedback form is given to the marine department staff to evaluate the Maritime Rescue Application System. This is important in regards to improving the Maritime Rescue System. The feedback form is shown in Appendix F. By referring to the feedback, 40% of the respondents are satisfied with this system. In addition, 20% of respondents say that this system is useful to them in conducting maritime rescue operations. This is because the systems are user friendly and can easily be accessed by the users. Figure 4.15 shows the percentage of the evaluation result. 78 Figure 4.15 Percentage of system evaluation 4.3.3.1 Vessel Location Menu An additional feature of this system is to show the vessel location on the map, based on the coordinates provided by the user. The coordinates must be included in the value of Latitude and Longitude. In the map display, the key for the vessel is a yellow triangle. To ensure that the vessel is shown as entered by the user, the evaluation is done by looking at the status box coordinates listed in the left corner of the system. When the coordinates are included (103.88X, 1.43Y) in the Vessel’s Location dialog box, the yellow triangle is displayed on the map as shown in Figure 4.16. Through this way, the marine department can monitor the position of the vessels in that area. 79 ** Maritime Rescue Application System File View Marine Search <3 , Zoom In or Help » Zoom Out Full Extent Pan e Identify Exit R? DEPTH (Z_VALUE) p LIGHTHOUSE W LIGHTHOUSE_GREEN W LIGHTHOUSE_VELLOW □ □ □ 17 LIGHTHOUSE_RED ■ 17 BUILDING [7 FIRE_BRIGADE □ 17 CONTOUR .y 17 SWAMP Figure 4.16 The ability of the system display vessel on the map Moreover, this menu consists of two interfaces, which are the vessel location main window and the vessel location information. The main window form consists of a list box, which displays vessels’ names and command buttons for Add Vessel, Delete Vessel, Remove Vessel, Display Vessel, and Exit, as shown in Figure 4.17. ■■ Vessel Location Main V e sse l 1 V e sse l 2 A d d V essel R e m o v e V e sse l D isplay V essel Exit Figure 4.17 Interface ofVessel Location Main window 80 Thus, when the user selects the vessel’s name in the list box and clicks on the Display command button, the data form displays the vessel information data such as the type of vessel, starting date of navigation, captain’s name, number of crew members on board, and vessel’s previous position. This system is able to show the current position of the vessel by using the Display Vessel button in vessel location information form. Figure 4.18 shows the details of the vessel location information. 81 ■ V ufcbC '.'h L U '-iJ liU M rKwoJ'.y-:-^ (km.': F Lupi*hod EMaViexd -F Dk. Cared SS8#fy-Mt. Iff?WOBfSl101MU 1.3M ttfd 1.40P tesJf Lhfri pH Figure 4.18 The information about the vessel location Besides that, this system allows the user to add the vessel’s information or new records of the vessel’s data. The user needs to select the Add Vessel command button and insert the information in the vessel location information form such as vessel type, captain’s name, date, number of crew members and vessel position. When the user clicks the OK button in the vessel information form, it automatically 82 saves the data and the vessel’s name will appear in the list box. This is important because if incidents occur, the marine department or an operator can review the navigation record. Figure 4.19 shows an example of the add and vessel information data. ■I Vww®Ifrjiiifn pMln P<*Vr.y- ■—1rrJ I -K -r b1m- ,|nnl" J J » p t |: n V f r ■r u i f i h m A H |vc.ai ' * [7* ft I 11 II *i Calendar « February 2010 » 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1G]:17 18 19 20 21 22 23 25 26 27 24 28 Figure 4.19 An Example of the add and vessel information data 83 4.3.3.2 Medical Assisted Menu In this research, to meet the second objective of this study, a Medical Assisted System is developed to assist the user, especially the Marine Department, where it can use the system as a reference if there is any emergency. During the navigation, the mariner often faces many obstacles while sailing although he is given intensive training in handling emergency matters. Examples of the obstacles that often occur are oil spills, accidents between vessels, unsafe working environment, and others. According to Miller 2009, injuries from non­ parted ropes or wires normally occur due to crew being caught up in ropes or wires or ropes or wires slipping off and becoming jammed on drum ends during normal mooring operations. Figure 4.20 shows the pie chart of injuries from mooring incidents. Figure 4.20 Injuries from mooring incidents (Source: International Marine Contractor Association, Safety Flash, April, 2009) 84 In that situation, if one of the crew members is injured due to the mooring accident, the mariners can make a report to the nearest Marine Department asking for medical support. The mariners are required to give all the information or details to the maritime rescue team such as location, type of injury, number of the crew, and others for its record. Then, the maritime rescue team will trace the nearest hospital to ask for on-site medical assistance such as paramedics, nurses, doctors, and medical equipments that is necessary to treat the crew members. In addition, through this system, the user can add a list of the hospitals by using the Add command button and click on the Save command button to save the information as shown in Figure 4.21. S^M edical Asssited List of Hospital Name Hospital Sultan Ismail Address Jin Persiarari Emas U tam a,Tam an M ount Austin State Johor City Johor Bahru Z ip Code 81100 C o n ta c t 07-3565000 Add S ave Previous Figure 4.21 Next Close The information of Hospital list menu 85 4.3.3.3 Fire and Rescue Menu The Fire and Rescue Department is an important agency in helping the maritime rescue team. According to the Star newspaper, dated 20 August 2008, “there was a fuel tank burning incident at Tanjung Langsat Port near Pasir Gudang. The Fire and Rescue Department had pooled resources from five states to battle the huge fire at the Tanjung Langsat Port Oil Terminal. The department had 222 strong team and 15 fire engines from Pahang, Negeri Sembilan, Perak, Malacca and Selangor, working round-the-clock to put out the fire from two gigantic fuel tanks. The department was assisted by the Pasir Gudang emergency action team comprising of trained fire-fighters from various petro chemical organisations based in Johor Port and Tanjung Langsat.” Therefore, the Fire and Rescue menu is developed in these maritime rescue application systems. This menu is developed to aid the users in searching for information or the location of Fire and Rescue Department based on the database provided. In addition, this system also allows users to update the list of the Fire and Rescue Departments using Add command button and Save command button tools. In this research, these systems are developed for the area of Pasir Gudang Port. Figure 4.22 shows the information of Fire and Rescue Department in Johor state area. 86 □ X » . Fire and Rescue List of Fire and Rescue Address State Poscode City Balai Bomba & Penyelam aUIn Masjid Pasir Gudang 81700 Johor Bahru Add Contact 07-2513444 Save i Newt Figure 4.22 4.4 i Previous Close The information on Fire and Rescue menu Summary This chapter discusses the effectiveness of map tools and marine search menu bar function. The ability of map tools function such as Zoom In, Zoom Out, Zoom Extent, and Pan are tested in the toolbar button. Meanwhile, Marine Search menu button is tested based on the capability of the system in searching for the vessel’s location, medical assistance such as hospital list to seek for on-site medical treatment, and others. Apart from that, the user is also able to update the maritime search and rescue information in the Marine Search menu. CHAPTER 5 CONCLUSION AND RECOMMENDATION 5.1 Introduction Generally, the objectives of this research ar achieved, which are (i) to design and develop a Maritim e Rescue Application Systems using Geographical Information System (GIS) Technology, (ii) to study the effectiveness of the database as a medium collection, storage, and data processing for the purpose of maritime rescue application system, and (iii) to analyze the results of the application based on the manipulation of a database. The results obtained from the evaluation tests of the system also prove that it could be a solution to the problem statement of this study. In this chapter, the summary of the whole research is discussed based on the methodology of the research. Moreover, conclusions and recommendations for future devlopment are also discussed in detail. 5.2 Conclusion In order to develop the systems, some phases ar discussed thoroughly and these are a literature review, data collection, database design, graphical user interface design, implementation, testing, and system evaluation phases. 88 The literature review is the first phase of this research. In the literature review, the development of the nautical charts from a paper chart to electronic nautical chart is discussed. Therefore, the electronic chart is used in this research to develop the maritime rescue application system. Other than that, the development of marine search and rescue is also reviewed in order to strengthen this research. The data used in this research is a nautical chart issued by the Royal Malaysian Navy. In this research, the nautical chart MAL 6128 is chosen where the study area is the Port of Pasir Gudang. However, the nautical chart is in raster format and needs to be converted into a vector format through the digitizing process. For the development of the system, Autodesk Map 2004, Microsoft Visual Basic 6.0, ESRI MapObjects 2.4, and ArcView 3.1 are also used for the system customization. On the other hand, the development of database design requires three phases, which are conceptual, logical, and physical designs. The database that links with spatial data is configured in ActiveX Data Object (ADO) data source. Apart from that, the spatial data can be integrated with the attribute data through the identify function, which enables users to get the information for every spatial layer. Other functions such as Zoom In, Zoom Out, Pan, Remove Active Layer, and Add Layer are successfully tested, which enable easier usage of the system. In addition, this system acts as a stand-alone system and only certain users such as a government departments are able to use this system. However, there are some recommendations and suggestions for further development that are related to this research. The development of marine technology, especially GIS, helps government agencies such as Marine Department in improving marine navigation systems, navigation operations, and others. Thus, the integration of GIS into marine search and rescue proves that GIS functionalities can really help users to access and update the information in an interactive way without the need of GIS software. Finally, the 89 expected ideas or recommendations in this research can also be adapted into these systems. 5.3 Recommendations In order to enhance this research, the following are some recommendations: i. This system can be improved by adding GIS elements such as data access in query function. Moreover, this system can also be improved by adding Notices to Mariners, search menu function, animation, and general information about maritime. ii. This system can be improved by integrating a self-monitoring system (Global Positioning System) for navigation purpose. With the GPS application, an user can monitor a vessel’s position in real time. However a programming should be included to integrate this system with GPS. iii. This system can be improved by using the standard specification of IHO S100 format issued by the International Hydrographic Organization (IHO). The IHO S-100 format is a geospatial standard for hydrographic and other geographic data. The IHO S-100 is aligned with the geographic standards thereby making the use of hydrographic and other geographic data more interoperable than previously, using the IHO S-57 data transfer standard. iv. This system is developed as a stand-alone system and only certain users can use this system. However, this system can also be enhanced with Internet based functions for easier access to the systems. 90 REFERENCES Austin, M. (2005). Creating A Geographic Information System from NOAA Electronic Navigational Charts. Proceedings o f the 14th Biennial Coastal Zone Conference. New Orleans, Louisiana. Bradley, J.C. and Millspaugh A.C. (2002). Programming in Visual Basic 6.0. New York: McGrawHill/Irwin. Bruce, A.R. (2001). Developing GIS Solutions with MapObjects and Visual Basic. USA: Onward Press Thomas Learning. Cham Tau Chia. (2006). The Design and Development o f Database fo r Charting Information Dissemination Using Web Based Geographic Information. Johor Bahru: Universiti Teknologi Malaysia. Electronic Chart Display and Information System (2008). Retrieved from December 2008.(http://en.wikipedia.org/wiki/Electronic_Chart_Display_and_Information _System). ESRI (Environmental System Research Institute), Inc. (1992). Using ArcView GIS. United State, America: ESRI. Green, D.R and King, S.D. (2003). An interactive Search and Rescue Systems. CoastGIS'03. Genova,Italy: Geographical Information System International Group. Global Maritim e Distress Safety System (2011). Retrieved from February 2011. (http://en.wikipedia.org/wiki/Global Maritime Distress Safety System). 91 Heywood, I., Crnelius, S. and Carver, S. (2002). An Introduction to Geographical Information Systems (2nd Edition.). England: Prentice Hall. Horanont, T., Tripathi, N.K. and Raghan, V. (2002). A Comparative Assessment o f Internet GIS Server Systems. India: School of Advanced Technologies Asian Institute of Technology. International Convention on Maritim e Search and Rescue (1979). Retrieved February 2010, from http://www.pomorci.com International Hydrographic Organisation (2008). Retrieved December 2008, from http://www.iho.schom.fr/ECDIS/introduction.htm International Hydrographic Organisation (2009). Spatial Data Infrastructures “The Marine Dimension”. Guidance for Hydrographic Offices (Edition 1.0): Monaco. International Hydrographic Bureau. International Hydrographic Organisation (2010). National Policies and Hydrographic Services. Monaco. International Hydrographic Bureau. International Marine Contractor Association (2009). Safety Flash. Retrieved January 2010, from http://www.imca-int.com Koay, C. W. (2000). Learning Microsoft Visual Basic 6.0 Step by Step. Kuala Lumpur: Venton Publishing. Malaysia Maritime Emergency Agency (2011). Global Maritime Distress Safety System. Retrieved February 2011, from http://www.mmea.gov.my. Miller, T. (2009). LP News.UK P&I Club.Safety Flash. Retrieved January 2010, from http://www.imca-int.com 92 Millet, N.G. and Evan,S. (2000). Hydrographic Data Management using GIS Technologies. Redlands, California: Environmental System Research Institute, Inc. Mittal, S.K. (2002). Roles o f Hydrographic Office and GIS/GPS-An Outline Survey. India Navy,National Hydrographic Office Dehradun. Mohd Razali Mahmud (2001). Nota Kuliah Hidrografi Lanjutan. Johor Bahru: Universiti Teknologi Malaysia. Motte, G.A. and Stout, T.M. (1990). Chartwork and Marine Navigation: For Fishermen and Boat Operators. Cornell Maritime Press, Inc. Noor Zalianee Ghazali (2008). Pembangunan Sistem Pangkalan Data Marin untuk Bantuan Navigasi di Pelabuhan. Johor Bahru. Universiti Teknologi Malaysia. Rigaux, P., Scholl, M. and Voisard, A. (2002). Spatial Databases with Application to GIS. USA: Morgan Kauffman. Royal Malaysia Navy (2003). Symbols and Abbreaviations used on Malaysian Nautical Charts. 4th Edition. Siti Fatimah Ismail (2005). Peta Elektronik untuk Universiti Teknologi Malaysia. Johor Bahru: Universiti Teknologi Malaysia. Steve Y.W.LAM, and Leyzack, A.E. (2007). Integrating GIS, ECDIS and Webbased Marine Information System for Maritime Navigation and Coastal Protection. FIG Working Week. Hong Kong, China. Vijayan, M. (2008). Fire at Tg Langsat Port put out. The Star .Retrieved December 2009, from http://www.thestar.com.my 93 Wright, P. (2003). Hydrographic Data and Geographical Information Systems. David R. Green and Stephen D.King, Coastal and Marine Geo-Information Systems (pp. 75-83). Netherlands: Kluwer Academic. 94 APPENDIX A List of Questionnaires for Development of M aritime Rescue Application System Please Tick ^ at the answer that you choose : 1) Have you ever heard of using Web-Based GIS (Geographic Information System) application to manage data? I 2) I IZZI No Does your organization have Maritime Rescue system? 1 I 3) Yes Yes 1 I No Does your organization own the system or is it provided by other sources? 1 I Yes 1 I No 4) If so, what are the system do you have in your organization? 5) Based on question 4, do you utilize the system? I 6) 7) I Yes I I No If so, for what purpose? 1 ISafety I Medical and fire rescue asssited 1 ISAR I Port movements What kind of maritime rescue operation do you usually look into? 1 I Oil spill I Medical and fire rescue assisted I I Other I Safety Navigation 95 8) What kind of information in a Nautical Chart do you usually look into for maritime rescue? I I Custom □ 9) Marine Department I I Hospital I I Radio/ Radar What kind of other information, do you think that it is important for maritime search and rescue? IZZI Lighthouse I I Buoys/Beacon □ Obstructions I 10) I Other _________________________________ Do you share your data with other users? 1 I Yes 11) I No Do you record data for replay? 1 I Yes 1 No 12) How long do you keep data for? 13) What kind of communication do you used in maritime rescue? □ so s CZI Radio □ Distress Signal 1 I Other __________________________________ 14) Based on question 14, if the answer is ‘Distress Signal’, what type of beacon do you use? 1 I Emergency Positioning Indicating Radio Beacon (EPIRB) □ Emergency Locator Transmitter (ELT) □ Personal Locator Beacon (PLB) 96 15) Do you think that it is needed to launch a proper information system for maritime rescue application? 1 IYes 16) 1 INo Is there any difficulties that have influenced your work especially in maritime rescue? 1 I Yes 1 INo THANK YOU FOR YOUR CO-OPERATION 97 APPENDIX B Malaysia Chart 98 APPENDIX C INTERFACE Option Explicit Private Sub cmdOK_Click() frmMain.Show Unload frmIntro End Sub Private Sub Form_Load() 'Center the form Dim topCorner As Integer Dim leftCorner As Integer topCorner = (Screen.Height - frmIntro.Height) \ 2 leftCorner = (Screen.Width - frmIntro.Width) \ 2 frmIntro.Move leftCorner, topCorner End Sub Form Main Option Explicit Private Const MIN LEGEND WIDTH = 350 Private Const INCH2FEET = 12 Private Const INCH2METERS = 39.37 Private Const INCH2DEGREES = 4322893.46 Public g ActiveLayer As Object Private Sub Form_Load() PicSplitter.BackColor = frmMain.BackColor legend.ZOrder 0 map.ZOrder 0 Me.Move 0, 0, Screen.Width, Screen.Height legend.setMapSource map legend.LoadLegend True 99 legend.ShowAllLegend legend.Active(O) = True ScaleBar1.ZOrder O AddMainData ReDim Vessel(O) End Sub Private Sub Form_Resize() 'This procedure resizes the map when the form is resized Dim Border As Double, sideBorder As Double Dim topBorder As Double, statusbarHeight As Double Border = 30 topBorder = 600 sideBorder = map.Left statusbarHeight = 400 map.Top = topBorder map.Left = sideBorder If ScaleHeight > topBorder + Border + statusbarHeight Then map.Height = ScaleHeight - topBorder - Border - statusbarHeight PicSplitter.Height = map.Height End If If ScaleWidth > (Border * 2) + sideBorder Then map.Width = ScaleWidth - (Border * 2) - sideBorder End If legend.Height = map.Height legend.Top = map.Top PicSplitter.Top = map.Top ScaleBar1.Move map.Left + map.Width - ScaleBar1.Width, map.Height - ScaleBar1.Height map.Top End Sub Private Sub legend_AfterSetLayerVisible(Index As Integer, isVisible As Boolean) map.Refresh End Sub Private Sub legend_LayerDblClick(Index As Integer) 'editor (frmLayerSymbol) for that layer. Set g ActiveLayer = map.Layers(Index) If g ActiveLayer.LayerType = moImageLayer Then MsgBox "sorry you cannot set properties for an image layer." & _ vbCrLf & "try setting properties for a layer with vector data." Exit Sub End If frmLayerSymbol.Show vbModal End Sub + 100 Private Sub map_AfterTrackingLayerDraw(ByVal hDC As StdOle.OLE HANDLE) Dim MySymbol As New mapobjects2.Symbol Dim MySymbol1 As New mapobjects2.Symbol Dim MyPoint As New mapobjects2.Point Dim txtSym As New mapobjects2.TextSymbol Dim i As Long ''return Filter shape to its default value 'Dim i As Long 'For i = 0 To map.Layers.Count - 1 ' If map.Layers(i).LayerType = moMapLayer Then ' Set map.Layers(i).FilterShape = Nothing ' End If 'Next i 'manipulate the scalebar: With ScaleBar1 .MapUnits = muMeters .ScaleBarUnits = suKM .ScreenUnits = suCentimeters .MinTicSpace = 0.5 .Font = "Tahoma" .ScaleText = RepresentativeFraction '.RFScale = "1:5000" End With With ScaleBar1.MapExtent .MinX = map.Extent.Left .MinY = map.Extent.Bottom .MaxX = map.Extent.Right .MaxY = map.Extent.Top End With With ScaleBar1.PageExtent .MinX = map.Left / Screen.TwipsPerPixelX .MinY = map.Top / Screen.TwipsPerPixelY .MaxX = (map.Left + map.Width) / Screen.TwipsPerPixelX .MaxY = (map.Top +map.Height) / Screen.TwipsPerPixelY End With ScaleBar1 .Refresh With MySymbol1 .color = vbYellow .Outline = True .OutlineColor = vbBlack .SymbolType = moPointSymbol .Style = moTriangleMarker .Size = 10 End With With MySymbol MySymbol.SymbolType = moFillSymbol MySymbol.color = vbWhite MySymbol.OutlineColor = vbBlack End With End Sub 101 Function Draw_Label(ThePoint As mapobjects2.Point, thetext As String) As mapobjects2.Polygon Dim Dim Dim Dim Dim Dim Dim Dim MyPoly As New mapobjects2.Polygon X As Long, Y As Long ArrowHight As Long Rect Length As Long R ectH ight As Long MyPoints As New mapobjects2.Points StartX As Single, StartY As Single TheCenterPointX As Single, TheCenterPointY As Single R ectLength = 1000 If Rect Length < 1000 Then Rect Length = 1000 R ectH ight = 300 ArrowHight = 200 map.FromMapPoint ThePoint, StartX, StartY MyPoints.Add ThePoint X = StartX Y = StartY - ArrowHight MyPoints.Add map.ToMapPoint(X, Y) X = X - Rect_Length / 2 Y=Y MyPoints.Add map.ToMapPoint(X, Y) X =X Y = Y - Rect Hight MyPoints.Add map.ToMapPoint(X, Y) X = X + Rect_Length Y=Y MyPoints.Add map.ToMapPoint(X, Y) X =X Y = Y + R ectH ight MyPoints.Add map.ToMapPoint(X, Y) X = X - Rect_Length / 2 + 0.4 * ArrowHight Y=Y MyPoints.Add map.ToMapPoint(X, Y) MyPoly.Parts.Add MyPoints Set Draw Label = MyPoly TheCenterPointX = StartX TheCenterPointY = StartY - ArrowHight - 0.5 * Rect_Hight 102 Set TheLabelPoint = map.ToMapPoint(TheCenterPointX, TheCenterPointY) End Function Private Sub map_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim curRectangle As New mapobjects2.Rectangle Dim Loc As New mapobjects2.Point If ToolbarDisplay.Buttons("zoomin").Value = tbrPressed Then Set map.Extent = map.TrackRectangle ElseIf ToolbarDisplay.Buttons("zoomout").Value = tbrPressed Then Set Loc = map.ToMapPoint(X, Y) curRectangle.Right = Loc.X + map.Extent.Width curRectangle.Left = Loc.X - map.Extent.Width curRectangle.Top = Loc.Y + map.Extent.Height curRectangle.Bottom = Loc.Y - map.Extent.Height Set map.Extent = curRectangle ElseIf ToolbarDisplay.Buttons("pan").Value = tbrPressed Then map.Pan ElseIf ToolbarDisplay.Buttons("identify").Value = tbrPressed Then Call frmIdentify.Identify(X, Y) frmIdentify.ZOrder 0 End If Set curRectangle = Nothing Set Loc = Nothing End Sub Private Sub map_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim curPoint As Point Dim curX As Double Dim curY As Double 'Convert screen coordinates to map coordinates Set curPoint = map.ToMapPoint(X, Y) curX = curPoint.X curY = curPoint.Y 'If map coordinates are large, suppress digits to right of decimal place. Dim cX As String, cy As String cX = curX cy = curY cX = Left(cX, InStr(cX, ".") + 2) cy = Left(cy, InStr(cy,".") + 2) StatusBar1.Panels(1).Text = "X:" & cX & " Y:" & cy End Sub Public Sub AddFile() Dim fullFile As String, path As String, tempChar As String, ext As String Dim Test As Boolean 103 Dim textPos As Long, periodPos As Long Dim curPath As String Dim strShape, strCAD, strVPF, strImage As String strShape = "ESRI Shapefiles (*.shp) |*.shp" strCAD = "CAD drawings (*.dwg,*.dxf) | *.dwg;*.dxf ’ strImage = "Standard image formats |*.bmp;*.dib;*.tif;*.jpg;*.jff;*.bil;*.bip;*.bsq;*.gis;*.lan;*.rlc;*.sid;*.sun;*.rs;*.ras;*. svf;*.img;*.gif" ' Set CancelError is True CommonDialog1.CancelError = True On Error GoTo FileOpenCancel CommonDialog1.Filter = strShape & "|" & strCAD & "|" & strImage & "|" CommonDialog1.DialogTitle = "Select file for new layer" CommonDialog1.ShowOpen If CommonDialog1.FileTitle = "" Then Exit Sub fullFile = Trim$(CommonDialog1.fileName) textPos = Len(fullFile) Test = False Do While Test = False textPos = textPos - 1 tempChar = Mid$(fullFile, textPos, 1) If tempChar = "." Then periodPos = textPos ElseIf tempChar = "\" Or textPos = 0 Then Test = True End If Loop curPath = Left$(fullFile, textPos - 1) 'Send the file name to the procedures that add the layers Dim fileName As String Dim pref As String fileName = CommonDialog1.FileTitle ext = LCase(Mid$(fullFile, periodPos + 1, 3)) Select Case ext Case "shp" Call addCustomShapeFile(curPath, fileName) Case "dwg", "dxf ’ Call addCAD(curPath, fileName) Case Else Call addImage(fullFile) End Select legend.LoadLegend Exit Sub FileOpenCancel: Exit Sub End Sub 104 Private Sub addImage(imageFile As String) 'This procedure validates and adds an image file to the Layers collection Dim iLayer As New ImageLayer iLayer.File = imageFile 'If the file is a valid image file, add it and move it to the 'bottom (last index) of the Layers collection. If map.Layers.Add(iLayer) Then map.Layers.MoveToBottom 0 Else MsgBox "This file, " & imageFile & ", is not a valid image file." End If End Sub Private Sub addCAD(basepath As String, cadfile As String) frmCAD.CadFileName = cadfile frmCAD. Show vbModal Dim dc As New mapobjects2.DataConnection Dim mlyr As New mapobjects2.MapLayer If frmCAD.chkCAD(2).Value = 1 Then dc.Database = "[CADArea]" & basepath If Not dc.Connect Then GoTo CADerror End If Set mlyr.GeoDataset = dc.FindGeoDataset(cadfile) map.Layers.Add mlyr End If Set dc = New mapobjects2.DataConnection Set mlyr = New mapobjects2.MapLayer If frmCAD.chkCAD(1).Value = 1 Then dc.Database = "[CADLine]" & basepath If Not dc.Connect Then GoTo CADerror End If Set mlyr.GeoDataset = dc.FindGeoDataset(cadfile) map.Layers.Add mlyr End If Set dc = New mapobjects2.DataConnection Set mlyr = New mapobjects2.MapLayer If frmCAD.chkCAD(0).Value = 1 Then dc.Database = "[CADPoint]" & basepath If Not dc.Connect Then GoTo CADerror End If Set mlyr.GeoDataset = dc.FindGeoDataset(cadfile) map.Layers.Add mlyr End If Set dc = New mapobjects2.DataConnection 105 Set mlyr = New mapobjects2.MapLayer If frmCAD.chkCAD(3).Value = 1 Then dc.Database = "[CADText]" & basepath If Not dc.Connect Then GoTo CADerror End If Set mlyr.GeoDataset = dc.FindGeoDataset(cadfile) map.Layers.Add mlyr End If 'Reset map legend and map contents list 'legMapDisp.LoadLegend Unload frmCAD Exit Sub CADerror: MsgBox "Unable to connect to " & basepath, vbCritical, "Stop" End Sub Private Sub addCustomShapeFile(basepath As String, shpfile As String) 'This procedure validates and adds a shape file to the Layers collection. Dim dCon As New DataConnection Dim gSet As GeoDataset Dim strShapefileType As String dCon.Database = basepath 'Set Database property of DataConnection If dCon.Connect Then shpfile = GetFirstToken(shpfile, ".") 'Extract suffix of shpfile string Set gSet = dCon.FindGeoDataset(shpfile) 'Find shapefile as GeoDataset in DataConnection If gSet Is Nothing Then MsgBox "Error opening shapefile " & shpfile, vbCritical Exit Sub Else If gSet.HasZ Then strShapefileType = "[SHAPEFILZ]" Else strShapefileType = "[SHAPEFILE]" End If Dim newLayer As New MapLayer newLayer.GeoDataset = gSet 'Set GeoDataset property of new MapLayer newLayer.Name = shpfile 'Set Name property of new MapLayer newLayer.Tag = strShapefileType & dCon.Database & "|" & newLayer.Name map.Layers.Add newLayer 'Add MapLayer to Layers collection End If Else 106 MsgBox "Error happens while openning the shapefile.", vbCritical, "Connection error" End If End Sub Function GetFirstToken(StrIn As String, Delim As String) As String ' Gets the portion of String "S", up to the ' first occurrance of delimiter "D" ' Returns String token "T" Dim Split As Long Dim Tok As String StrIn = Trim$(StrIn) Split = InStr(1, StrIn, Delim) If (Split <= 0) Then Tok = StrIn Else Tok = (Trim$(Left$(StrIn, Split - 1))) End If GetFirstToken = Tok End Function Private Sub mnuAddLayer_Click() AddFile End Sub Private Sub mnuExit_Click() ExitApplication End Sub Private Sub mnuFind_Click() Load frmFind frmFind.Move 100, 2500 frmFind.Show 1 End Sub Private Sub mnuHelp_About_Click() 'Load FrmAbout 'FrmAbout.Move 200,3500 FrmAbout.Show 1 End Sub Private Sub mnuIdentify_Click() PressButton "identify" ToolbarDisplay.Buttons("identify").Value = tbrPressed map.MousePointer = moIdentify End Sub 107 Private Sub mnuLegendEditor_Click() Dim Index As Integer Index = legend.getActiveLayer If Index = -1 Then MsgBox "There is no active layer.", vbCritical, "Stop" Exit Sub End If Set g ActiveLayer = map.Layers(Index) If map.Layers(Index).LayerType = moImageLayer Then MsgBox "Sorry, you cannot set properties for an image layer.", vbCritical, "Stop" Exit Sub End If 'Invoke property sheet for new layer. frmLayerSymbol.Show vbModal End Sub Private Sub mnuMaritime_Click() 'mnuClearVessel.Enabled = Vessel.IsShow End Sub Private Sub mnumedical_Click() Load frmMedicalAssited frmMedicalAssited.Move 100, 2500 frmMedicalAssited.Show 1 End Sub Private Sub mnuPan_Click() PressButton "pan" ToolbarDisplay.Buttons("pan").Value = tbrPressed map.MousePointer = moPan End Sub Private Sub mnuRemoveActiveLayer_Click() Dim Index As Long Index = legend.getActiveLayer If Index o - 1 Then map.Layers.Remove Index legend.LoadLegend 'Refresh legend Else MsgBox "The map has no active layer.", vbExclamation Exit Sub End If End Sub 108 Private Sub mnuShowScaleBar_Click() mnuShowScale.Checked = Not mnuShowScale.Checked ScaleBar1.Visible = mnuShowScale.Checked End Sub Private Sub mnuVesselPositon_Click() Load frmVesselLocation frmVesselLocation.Show 1 End Sub Private Sub mnuZoomExtent_Click() map.Extent = map.FullExtent End Sub Private Sub mnuZoomIn_Click() PressButton "zoomin" ToolbarDisplay.Button("zoomin").Value = tbrPress map.MousePointer = moZoomIn End Sub Private Sub mnuZoomOut_Click() PressButton "zoomout" ToolbarDisplay.Button("zoomout").Value = tbrPress map.MousePointer = moZoomOut End Sub Private Sub PicSplitter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'the picSplitter allowsimultenous resizing of the legend and map 'by grabing and dragging the two controls If Button = 1 Then PicSplitter.Left = PicSplitter.Left + X - 50 If PicSplitter.Left > M IN LEG EN D W ID TH Then frmMain.Refresh Else PicSplitter.Left = M IN LEG EN D W ID TH PicSplitter_MouseUp Button, Shift, X, Y End If End If End Sub Private Sub PicSplitter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) PicSplitter.BackColor = frmMain.BackColor legend.Width = legend.Left + PicSplitter.Left map.Left = PicSplitter.Left + PicSplitter.Width map.Width = frmMain.Width - legend.Width - PicSplitter.Width - 180 PicSplitter.ZOrder 1 End Sub 109 Sub AddMainData() Dim lyr As mapobjects2.MapLayer Dim vmr As New mapobjects2.ValueMapRenderer 'Dim grpRend As New MapObjects2.GroupRenderer 'Dim my symbol As New MapObjects2. map.BackColor = RGB(255, 255, 255) addShapeFile App.path, "water shallow.shp", "water shallow", map Set lyr = map.Layers("water_shallow") lyr.Symbol.color = RGB(40, 40, 255) addShapeFile App.path, "water less deep.shp", "water less deep", map Set lyr = map.Layers("water_less deep") lyr.Symbol.color = RGB(0, 255, 255) addShapeFile App.path, "waterdeep.shp", "waterdeep", map Set lyr = map.Layers("water_deep") lyr.Symbol.color = RGB(255, 255, 255) addShapeFile App.path, "depth.shp", "depth", map Set lyr = map.Layers("depth") With vmr .Field = "ZVALUE" .ValueCount = 1 .Value(0) = "" .SymbolType = moPointSymbol 'IMPORTANT .Symbol(0).SymbolType = moPointSymbol .Symbol(0).Style = moCircleMarker .Symbol(0).color = RGB(255, 0, 255) .Symbol(0).0utline = True .Symbol(0).Size = 3 .DefaultSymbol.SymbolType = moPointSymbol .DefaultSymbol.Style = moCircleMarker .DefaultSymbol.Size = 3 .DefaultSymbol.Outline = True .DefaultSymbol.color = RGB(255, 0, 255) .UseDefault = True .Tag = "vmr" End With grprendererdepth.A dd vmr Set lyr = map.Layers("depth") Set lyr.Renderer = grp renderer depth 'Set grpRend = Nothing Set vmr = Nothing Set lyr = Nothing addShapeFile App.path, "land.shp", "land", map Set lyr = map.Layers("land") lyr.Symbol.color = RGB(255, 255, 0) 110 addShapeFile App.path, "road.shp", "road", map Set lyr = map.Layers("road") lyr.Symbol.color = RGB(0, 0, 255) addShapeFile App.path, "village.shp", "village", map Set lyr = map.Layers("village") lyr.Symbol.color = RGB(255, 0, 255) addShapeFile App.path, "marine dp.shp", "marine dp", map Set lyr = map.Layers("marine dp") lyr.Symbol.color = RGB(0, 0, 255) addShapeFile App.path, "swamp.shp", "swamp", map Set lyr = map.Layers("swamp") lyr.Symbol.color = RGB(0, 128, 0) addShapeFile App.path, "contour.shp", "contour", map Set lyr = map.Layers("contour") lyr.Symbol.color = RGB(255, 0, 0) addShapeFile App.path, "fire brigade.shp", "fire brigade", map Set lyr = map.Layers("fire_brigade") lyr.Symbol.color = RGB(0, 255, 0) addShapeFile App.path, "building.shp", "building", map Set lyr = map.Layers("building") lyr.Symbol.color = RGB(0, 0, 255) addShapeFile App.path, "lighthouse_red.shp", "lighthouse red", map Set lyr = map.Layers("lighthouse_red") lyr.Symbol.color = RGB(255, 0, 0) addShapeFile App.path, "lighthouse_yellow.shp", "lighthouse_yellow", map Set lyr = map.Layers("lighthouse_yellow") lyr.Symbol.color = RGB(255, 255, 0) addShapeFile App.path, "lighthouse_green.shp", "lighthouse_green", map Set lyr = map.Layers("lighthouse_green") lyr.Symbol.color = RGB(0, 255, 0) addShapeFile App.path, "lighthouse.shp", "lighthouse", map Set lyr = map.Layers("lighthouse") lyr.Symbol.color = RGB(0, 255, 255) map.Extent = map.FullExtent map.Refresh legend.LoadLegend End Sub 111 Sub ShowLabels(TheMap As mapobjects2.map, layerName As String, GroupRenderer As mapobjects2.GroupRenderer, LabelField As String, MinScale As Double, FontName As String, FontBold As Boolean, FontHight As Long, color As Long, MaskLabel As Boolean, MaskColor As Long) Dim Dim Dim Dim Dim lyr As mapobjects2.MapLayer fnt As New StdOle.StdFont lp As New mapobjects2.LabelPlacer scaleHeightUnit As Double i As Integer For i = 0 To GroupRenderer.Count - 1 If GroupRenderer.Renderer(i).Tag = "labels" Then GroupRenderer.Remove i Exit For End If Next i If GetMapScale(TheMap) > MinScale Then Exit Sub Set lyr = TheMap.Layers(layerName) lp.Field = LabelField fnt.Name = FontName fnt.Bold = FontBold scaleHeightUnit = FontHeight 'lyr.Extent.Width / 10000 W ith lp.DefaultSymbol .Height = FontHight .color = color Set .Font = fnt End With If MaskLabel = True Then lp.MaskLabels = True lp.MaskColor = MaskColor Else lp.MaskLabels = False End If lp.Tag = "labels" GroupRenderer.Add lp Set lyr.Renderer = GroupRenderer Set lyr = Nothing Set lp = Nothing Set fnt = Nothing End Sub Private Sub ToolbarDisplay_ButtonClick(ByVal Button As MSComctlLib.Button) 112 Select Case Button.Key Case "zoomin" PressButton (Button.Key) map.MousePointer = moZoomIn Case "zoomout" PressButton (Button.Key) map.MousePointer = moZoomOut Case "pan" PressButton (Button.Key) map.MousePointer = moPan Case "prev" Case "zoomext" map.Extent = map.FullExtent Case "search" Case "identify" PressButton (Button.Key) map.MousePointer = moIdentify Case "close" ExitApplication End Select End Sub Sub PressButton(ButtonKey As String) Dim i As Integer For i = 1 To ToolbarDisplay.Buttons.Count If ToolbarDisplay.Buttons(i).Key <> ButtonKey Then ToolbarDisplay.Buttons(i).Value = tbrUnpressed End If Next i End Sub iii) Identify Option Explicit Private Const SEA RC H TO LPIXELS = 3 Dim Loc As New Point Dim Recs2() As mapobjects2.Recordset Dim layerName() As String Dim layerNum() As Long Sub Identify(X As Single, Y As Single) Dim curCount As Long, layerCount As Long, layer_c As Long Dim Loc As New mapobjects2.Point Dim theTol As Double Dim featCount As Long, fCount As Long Dim aLayer As Object Dim recs As mapobjects2.Recordset Dim aName As String, theItem As String 113 Dim aField As Object layerc = frmMain.map.Layers.Count ReDim layerName(layer c) ReDim Recs2(layer_c) Screen.MousePointer =11 'Get identify lblLocation. cboIDList.Clear lstFeatlist.Clear lblFeatFound.Caption = "Searching ..." lblTheme.Caption = "Theme:" lblShapeType.Caption = "Shape:" Set Loc = frmMain.map.ToMapPoint(X, Y ) Dim xStr As String, yStr As String 'If coordinates are lat-longs, we don't want to truncate, 'but if they are greater, we only want to show the integer values. IfL o c.X > 1000 Or Loc.Y > 1000 Then xStr = Int(Loc.X): yStr = Int(Loc.Y) Else xStr = Loc.X: yStr = Loc.Y End If lbllocation.Caption = "Location: (" & xStr & "," + yStr + ")" featCount = 0 layerCount = -1 'Set the tolerance: theTol = frm Main.map.ToMapDistance(SEARCHTOLPIXELS Screen.TwipsPerPixelX) For Each aLayer In frmMain.map.Layers If aLayer.Visible And aLayer.LayerType = moMapLayer Then Setrecs = aLayer.SearchByDistance(Loc, theTol, "") 'Loop through selected features and store pointers. layerCount = layerCount + 1 layerName(layerCount) = aLayer.Name Set Recs2(layerCount) = recs curCount = -1 If recs.Count <> 0 Then aName = "Featureid" 'Determine main string (or ID ) field to list. For Each aField In recs.Fields If aField.Type = moString Then aName = aField.Name Exit For End If Next End If While Not recs.EOF ReDim Preserve layerNum(2, featCount +1) curCount = curCount + 1 layerNum(1, featCount) = layerCount layerNum(2, featCount) = curCount featCount = featCount + 1 114 theItem = recs(aName).ValueAsString If theItem = "" Then cboIDList.AddItem recs("FeatureId").ValueAsString Else cboIDList.AddItem theItem End If recs.MoveNext Wend End If Next aLayer 'Set feature count label. Visible = True If featCount = 1 Then lblFeatFound.Caption = "1 feature found" Else lblFeatFound.Caption = Str(featCount) + " features found" End If 'Exit sub if no features were found. If featCount > 0 Then cboIDList.ListIndex = 0 Call Identify_list End If Screen.MousePointer = 0 End Sub Sub Identify_list() Dim curRec As mapobjects2.Recordset Dim curIndex As Long, aIndex As Long, aRec As Long, i As Long Dim aField As Object Dim aName As String curIndex = cboIDList.ListIndex If IsNull(cboIDList.List(aIndex)) Then Exit Sub End If aIndex = layerNum(1, curIndex) aRec = layerNum(2, curIndex) aName = layerName(aIndex) I ' Set curRec variable to the correct record. I Set curRec = Recs2(aIndex) curRec.MoveF irst If aRec > 0 Then For i = 1 To aRec curRec.MoveNext Next i End If frmMain.map.FlashShape curRec("shape").Value, 1 ' List the attribute values for the selected feature. 115 lblTheme.Caption = "Theme: " + aName lstFeatlist.Clear For Each aField In curRec.Fields Select Case aField.Type Case moString lstFeatlist.AddItem aField.Name + " = " + aField.Value Case moPoint lblShapeType.Caption = "Shape Type: Point" Case moLine lblShapeType.Caption = "Shape Type: Line" Case moPolygon lblShapeType.Caption = "Shape Type: Polygon" Case Else lstFeatlist.AddItem aField.Name + " = " + aField.ValueAsString End Select Next aField End Sub Private Sub cboIDList_Click() Identify_list End Sub Private Sub Form_Load() 'Position to the right of the main form Me.Move frmMain.Left + frmMain.Width, frmMain.Top If (Me.Left + Me.Width) > Screen.Width Then Me.Left = Screen.Width -Me.Width End If End Sub iv) Form Layer Symbol Option Explicit Dim Dim Dim Dim strMarkerStyle(4) As String strLineStyle(4) As String strFillStyle(10) As String strPanelDesc(5) As String Dim Dim Dim Dim Dim lyr As mapobjects2.MapLayer recs As mapobjects2.Recordset tDesc As mapobjects2.TableDesc flds As mapobjects2.Fields a As Integer 116 Dim vmr As mapobjects2.ValueMapRenderer Dim cbr As mapobjects2.ClassBreaksRenderer Dim lr As mapobjects2.LabelRenderer Dim lp As mapobjects2.LabelPlacer Dim zRend As mapobjects2.ZRenderer Dim lfactor As Double Dim colorMask, colorText As Long DimjustOpened As Boolean Private Sub Form_Load() Dim i As Integer Dim fnt As New StdFont 'Position this form into the top right 'corner of the screen Me.Move 500, 2000 colorText = moBlack colorMask = moWhite Set lyr = frmMain.g_ActiveLayer Set recs = lyr.Records Set tDesc = recs.TableDesc Set flds = recs.Fields frmLayerSymbol.Caption = "Symbol properties for the " & UCase(lyr.Name) & " layer." strPanelDesc(0) = "The Single Symbol classification displays all the features in a layer with the same symbol." strPanelDesc(1) = "The Unique Values classification displays features by applying a symbol to each unique value for a specified field." strPanelDesc(2) = "The Class Breaks classification applies symbols to a set of discrete values." strPanelDesc(3) = "The Standard Labels classification draws text for a specified field." strPanelDesc(4) = "The No Overlapping Labels classication draws text for a specified field and attempts to resolve overlapping and crowding of labels." strPanelDesc(5) = "The Elevation classification draws features according to their Z values, if the data supports it." txtLayerName = lyr.Name strMarkerStyle(0) = "Circle marker" strMarkerStyle(1) = "Square marker" strMarkerStyle(2) = "Triangle marker" strMarkerStyle(3) = "Cross marker" strMarkerStyle(4) = "TrueType marker" strLineStyle(0) = "Solid line" strLineStyle(1) = "Dash line" strLineStyle(2) = "Dot line" 117 strLineStyle(3) = "Dash dot line" strLineStyle(4) = "Dash dot dot line" strFillStyle(0) =="Solid fill" strFillStyle(1) =1"Transparent fill" strFillStyle(2) =: "Horizontal fill" strFillStyle(3) =="Vertical fill" strFillStyle(4) =1"Upward diagonal" strFillStyle(5) =1"Downward diagonal" strFillStyle(6) =="Cross fill" strFillStyle(7) =1"Diagonal cross fill" strFillStyle(8) =="Light gray fill" strFillStyle(9) =="Gray fill" strFillStyle(10) = "Dark gray fill" justOpened = True 'Read the contents of the active layer's Renderer property. 'Run one of the "Load..." procedures to populate the appropriate 'tab with the current renderer's properties. Select Case True Case lyr.Renderer Is Nothing sstLayerProp.Tab = 0 Call LoadSingleSymbol Case TypeOf lyr.Renderer Is mapobjects2.ValueMapRenderer sstLayerProp.Tab = 1 Call LoadUniqueValues Case TypeOf lyr.Renderer Is mapobjects2.ClassBreaksRenderer sstLayerProp.Tab = 2 Call LoadClassBreaks Case TypeOf lyr.Renderer Is mapobjects2.LabelRenderer sstLayerProp.Tab = 3 Call LoadStandardLabels Case TypeOf lyr.Renderer Is mapobjects2.LabelPlacer sstLayerProp.Tab = 4 colorMask = lyr.Renderer.MaskColor Call LoadNoOverlapLabels Case TypeOf lyr.Renderer Is mapobjects2.ZRenderer sstLayerProp.Tab = 5 Call LoadZRenderer Case Else sstLayerProp.Tab = 0 Call LoadSingleSymbol End Select 'If the active layer does not support Z shapes, disable 'the "Elevation" rendering tab. If (InStr(lyr.Tag, "[SH A P EFILZ ]") = 0) And (InStr(lyr.Tag, "[SD EZ ]") = 0) Then sstLayerProp.TabEnabled(5) = False End If 118 End Sub Private Sub cmdApply_Click() 'When the user hits the Apply button (or the OK button) 'read the option controls on the active tab, and use 'them to build a new renderer with which to draw the layer. Select Case sstLayerProp.Tab Case 0: Call ApplySingleSymbol Case 1: CallApplyUniqueValues Case 2: Call ApplyClassBreaks Case 3: Call ApplyStandardLabels Case 4: Call ApplyNoOverlapLabels Case 5: Call ApplyZRenderer End Select 'Rename the layer with the contents of txtLayerName.Text lyr.Name = txtLayerName.text 'Refresh the map legend frmMain.legend.LoadLegend 'Redraw the map frmMain.map.Refresh End Sub Private Sub cmdCancel_Click() 'Throw away all work on this form. 'Layer retains original rendering information. Unload frmLayerSymbol End Sub Private Sub cmdOK_Click() 'Use Apply, then unload Call cmdApply Click Unload frmLayerSymbol End Sub Private Sub cmdNOL_Click() 'Choose font properties for the LabelPlacer cdlgLayerProp.color = colorText cdlgLayerProp.Flags = cdlCFEffects Or cdlCFBoth cdlgLayerProp. ShowFont TxtNOL.ForeColor = cdlgLayerProp.color TxtNOL.text = cdlgLayerProp.FontName 119 colorText = cdlgLayerProp.color End Sub Private Sub cm dSL_Click() 'Choose font properties for the LabelRenderer cdlgLayerProp.Flags = cdlCFEffects Or cdlCFBoth cdlgLayerProp. ShowFont txtSL.ForeColor = cdlgLayerProp.color txtSL.text = cdlgLayerProp.FontName End Sub Private Sub cm dCB_Click() 'Build a new tentative class breaks legend Call PopulateNewCBlegend(cboCB(0).text) cmdApply.Enabled = True cmdOK.Enabled = True End Sub Private Sub cm dUV_Click() 'Build a new tentative unique values legend Call PopulateNewUVlegend(cboUV.text) cmdApply.Enabled = True cmdOK.Enabled = True End Sub Private Sub cm dZR_Click() 'Build a new tentative Z elevation breaks legend Call PopulateNewZRLegend cmdApply.Enabled = True cmdOK.Enabled = True End Sub Private Sub cboSSP_Click(Index As Integer) Dim fnt As New StdFont Select Case Index Case 0 'choose single symbol style If Index = 0 Then If cboSSP(0).text = "TrueType marker" Then 120 Dim i As Integer cboSSP(1).Enabled = True cboSSP(2).Enabled = True lblSSP(3).Enabled = True lblSSP(4).Enabled = True lblSSP(5).Enabled = True lblSSP(7).Enabled = True hsbSSP.Enabled = True For i = 0 To Screen.FontCount - 1 cboSSP(1).AddItem Screen.Fonts(i) Next i cboSSP(1).ListIndex = 0 fnt.Name = cboSSP(1).text Set cboSSP(2).Font = fnt cboSSP(2).Clear For i = 0 To 255 cboSSP(2).AddItem Chr(i) Next Else 'if not TT font, then disable controls specific to TT fonts cboSSP(1).Clear cboSSP(2).Clear cboSSP(1).Enabled = False cboSSP(2).Enabled = False lblSSP(3).Enabled = False lblSSP(4).Enabled = False lblSSP(5).Enabled = False lblSSP(7).Enabled = False hsbSSP.Enabled = False End If End If Case 1 'populate combobox list of TT font glyphs in the chosen font cboSSP(2).Clear fnt.Name = cboSSP(1).text Set cboSSP(2).Font = fnt For i = 0 To 255 cboSSP(2).AddItem Chr(i) Next End Select End Sub Private Sub hsbSSP_Change() 'Sets the rotation on a single symbol point marker 'that is using a TT font lblSSP(7).Caption = hsbSSP.Value 121 End Sub Private Sub hsbSL_Scroll() 'Sets the rotation on standard label text lblSL(7).Caption = hsbSL.Value End Sub Private Sub hsbSL_Change() 'Sets the rotation on standard label text lblSL(7).Caption = hsbSL.Value End Sub Private Sub picCBramp_Click(Index As Integer) 'Sets start and stop ramp colors for class breaks renderer cdlgLayerProp.ShowColor picCBramp(Index).BackColor = cdlgLayerProp.color End Sub Private Sub picNOL_Click() 'User changes the MaskColor of the LabelPlacer If colorMask <> moWhite Then cdlgLayerProp.color = colorMask End If cdlgLayerProp.ShowColor picNOL.BackColor = cdlgLayerProp.color colorMask = cdlgLayerProp.color 'Turn on the MaskLabels check box chkNOL(2).Value = 1 End Sub Private Sub picSSP_Click(Index As Integer) 'Sets the color for single symbol rendering cdlgLayerProp.ShowColor picSSP(Index).BackColor = cdlgLayerProp.color End Sub Private Sub vsbUV_Change() 'If the legend preview is too large for its 122 'frame container, use the V SB to move it up 'and down on demand. fraUVinner.Top = 200 - (vsbUV.Value * 200) End Sub Private Sub sstLayerProp_Click(PreviousTab As Integer) 'When the user clicks one of the renderer tabs, determine 'whether the active layer is already using that type of 'renderer. Then... ' ...if it is, then read the properties of that layer and ' use those properties to load the various option ' controls on that tab. Use one of the "Load..." procedures. ' ...or if it is not, then load the various option controls ' controls on that tab with some default values. Use ' one of the "Init..." procedures. Dim lyrRend As Object lblPanelDesc.Caption = strPanelDesc(sstLayerProp.Tab) If lyr.Renderer Is Nothing Then 'Use of the Point class here is arbitrary Set lyrRend = New mapobjects2.Point 'and only temporary in use. V B's "TypeOf" Else 'keyword has trouble with "Nothing", which Set lyrRend = lyr.Renderer 'is what the Layer's Renderer property holds End If 'when drawing the layer with a single symbol. If PreviousTab = 2 Then IfTypeO f lyrRend Is mapobjects2.ValueMapRenderer Then Exit Sub End If End If Select Case sstLayerProp.Tab Case 0 IfTypeO f lyrRend Is mapobjects2.Point Then Call LoadSingleSymbol Else Call InitSingleSymbol End If Case 1 If TypeOf lyrRend Is mapobjects2.ValueMapRenderer Then Call LoadUniqueValues Else Call InitUniqueValues End If Case 2 If TypeOf lyrRend Is mapobjects2.ClassBreaksRenderer Then Call LoadClassBreaks 123 Else Call InitClassBreaks End If Case 3 If TypeOf lyrRend Is mapobjects2.LabelRenderer Then Call LoadStandardLabels Else Call InitStandardLabels End If Case 4 If TypeOf lyrRend Is mapobjects2.LabelPlacer Then Call LoadNoOverlapLabels Else Call InitNoOverlapLabels End If Case 5 IfTypeO f lyrRend Is mapobjects2.ZRenderer Then Call LoadZRenderer Else Call InitZRenderer End If End Select End Sub ' InitSingleSymbol() ' InitUniqueValues() ' InitClassBreaks() ' InitStandardLabels() ' InitNoOverlapLabels() ' InitZRenderer() Private Sub InitSingleSymbol() Dim i As Integer Dim fnt As New StdFont cboSSP(0).Clear Select Case lyr.shapeType Case moShapeTypePoint 'set control visibility cboSSP(1).Visible = True cboSSP(2).Visible = True chkSSP.Visible = False hsbSSP.Visible = True picSSP(1).Visible = False lblSSP(3).Visible = True lblSSP(4).Visible = True lblSSP(5).Visible = True lblSSP(6).Visible = False lblSSP(7).Visible = True 124 'retrieve and display current values txtSSP(0).text = 5 lblSSP(0).Caption = "Marker Color:" lblSSP(2).Caption = "Size:" For i = 0 To 4 cboSSP(0).AddItem strMarkerStyle(i) Next picSSP(0).BackColor = moGreen cboSSP(0).text = strMarkerStyle(moSquareMarker) cboSSP(0).ListIndex = 1 hsbSSP.Value = 0 lblSSP(7).Caption = "0" cboSSP(1).Enabled = False cboSSP(2).Enabled = False lblSSP(3).Enabled = False lblSSP(4).Enabled = False lblSSP(5).Enabled = False lblSSP(7).Enabled = False hsbSSP.Enabled = False Case moShapeTypeMultipoint 'set control visibility cboSSP(1).Visible = True cboSSP(2).Visible = True chkSSP.Visible = False hsbSSP.Visible = True picSSP(1).Visible = False lblSSP(3).Visible = True lblSSP(4).Visible = True lblSSP(5).Visible = True lblSSP(6).Visible = False lblSSP(7).Visible = True 'retrieve and display current values txtSSP(0).text = 5 lblSSP(0).Caption = "Marker Color:" lblSSP(2).Caption = "Size:" For i = 0 To 4 cboSSP(0).AddItem strMarkerStyle(i) Next picSSP(0).BackColor = moGreen cboSSP(0).text = strMarkerStyle(moSquareMarker) cboSSP(0).ListIndex = 1 hsbSSP.Value = 0 lblSSP(7).Caption = "0" cboSSP(1).Enabled = False cboSSP(2).Enabled = False lblSSP(3).Enabled = False lblSSP(4).Enabled = False lblSSP(5).Enabled = False lblSSP(7).Enabled = False hsbSSP.Enabled = False 125 Case moLine 'set visibility cboSSP(1).Visible = False cboSSP(2).Visible = False chkSSP.Visible = False hsbSSP.Visible = False picSSP(1).Visible = False lblSSP(3).Visible = False lblSSP(4).Visible = False lblSSP(5).Visible = False lblSSP(6).Visible = False lblSSP(7).Visible = False 'retrieve and display current values txtSSP(0).text = 1 lblSSP(0).Caption = "Line Color:" lblSSP(2).Caption = "Line width:" For i = 0 To 4 cboSSP(0).AddItem strLine Style(i) Next picSSP(0).BackColor = moBlue cboSSP(0).text = strLineStyle(0) cboSSP(0).ListIndex = 0 Case moPolygon 'set visibility cboSSP(1).Visible = False cboSSP(2).Visible = False chkSSP.Visible = True hsbSSP.Visible = False picSSP(1).Visible = True lblSSP(3).Visible = False lblSSP(4).Visible = False lblSSP(5).Visible = False lblSSP(6).Visible = True lblSSP(7).Visible = False 'retrieve and display current values 1xtSSP(0).text = "1" lblSSP(0).Caption = "F ill Color:" lblSSP(2).Caption = "Outline width:" For i = 0 To 10 cboSSP(0).AddItem strFillStyle(i) Next picSSP(0).BackColor = moLightGray picSSP(1).BackColor = moBlack cboSSP(0).text = strFillStyle(0) cboSSP(0).ListIndex = 0 chkSSP.Value = 1 End Select cmdApply.Enabled = True cmdOK.Enabled = True 126 End Sub Private Sub InitUniqueValues() Dim i As Integer 'Load ComboBox with layer field names cboUV.Clear For i = 0 To tDesc.FieldCount - 1 cboUV.AddItem tDesc.FieldName(i) Next cboUV.ListIndex = 0 FraUVouter.Caption = "Legend Preview" 'If a legend already exists, unload it If picUV.Count > 1 Then For i = (picUV.Count - 1)To 1 Step -1 Unload picU V(i) Unload LBLu v(i) Next End If picUV(0).Visible = False LBLuv(0).Visible = False cmdApply.Enabled = False cmdOK.Enabled = False chkUV.Visible = (lyr.shapeType = moShapeTypePolygon) End Sub Private Sub InitClassBreaks() Dim i As Integer Dim fld As mapobjects2.Field 'Clear and reload ComboBoxes cboCB(0).Clear cboCB(0).AddItem "FeatureID" cboCB(1).ListIndex = 3 For i = 0 To tDesc.FieldCount - 1 Set fld = flds(tDesc.FieldName(i)) If fld.Type = moDouble Or fld.Type = moLong Then cboCB(0).AddItem fld.Name End If Next cboCB(0).ListIndex = 0 'If a legend already exists, unload it If picCBlegend.Count > 1 Then For i = (picCBlegend.Count - 1) To 1 Step -1 127 Unload picCBlegend(i) Unload lblCBlegend(i) Next End If picCBlegend(0).Visible = False lblCBlegend(0).Visible = False cmdApply.Enabled = False cmdOK.Enabled = False chkCB.Visible = (lyr.shapeType = moShapeTypePolygon) End Sub Private Sub InitStandardLabels() Dim i As Integer Dim sFirstStringFld As Integer, bFoundString As Boolean bFoundString = False For i = 0 To tDesc.FieldCount - 1 cboSL(0).AddItem tDesc.FieldName(i) If tDesc.FieldType(i) = moLong Or _ tDesc.FieldType(i) = moDouble Then cboSL(3).AddItem tDesc.FieldName(i) cboSL(4).AddItem tDesc.FieldName(i) ElseIf (Not bFoundString) And (tDesc.FieldType(i) = moString) Then sFirstStringFld = i bFoundString = True End If Next cboSL(0).ListIndex = sFirstStringFld cboSL(1).ListIndex = 1 cboSL(2).ListIndex = 1 cdlgLayerProp.FontName = "M S Sans S e rif cdlgLayerProp.FontSize = 10 cdlgLayerProp.FontBold = False cdlgLayerProp.FontItalic = False cdlgLayerProp.FontStrikethru = False cdlgLayerProp.FontUnderline = False cdlgLayerProp.color = moBlack cmdApply.Enabled = True cmdOK.Enabled = True ' This function may be called if the layer currently has a ' LabelPlacer set. If Not lyr.Renderer Is Nothing Then If TypeOf lyr.Renderer Is mapobjects2.LabelPlacer Then ' Work out scale based on layer's extent. This value w ill be used ' to help convert the slider height value into a label size in ' map units. Dim scaleHeightUnit As Double 128 scaleHeightUnit = lyr.Extent.Width / 10000 ' Use size from existing LabelPlacer. Dim currSizeMapUnits As Double currSizeMapUnits = lyr.Renderer.DefaultSymbol.Height Dim sglTemp As Single sglTemp = frmMain.map.FromMapDistance(currSizeMapUnits) * (1 / lfactor) Dim currSizePoints As Double currSizePoints = ScaleY(sglTemp, vbTwips, vbPoints) cdlgLayerProp.FontSize = currSizePoints ' Copy other values if appropriate. cboSL(0).text = lyr.Renderer.Field End If End If End Sub Private Sub InitNoOverlapLabels() Dim i As Integer Dim scaleHeightUnit As Double cboNOL.Clear Dim sFirstStringFld As Integer, bFoundString As Boolean bFoundString = False For i = 0 To tDesc.FieldCount - 1 cboNOL.AddItem tDesc.FieldName(i) If (Not bFoundString) And (tDesc.FieldType(i) = moString) Then sFirstStringFld = i bFoundString = True End If Next cboNOL.ListIndex = sFirstStringFld cdlgLayerProp.FontName = "M S Sans Serif" cdlgLayerProp.FontSize = 10 cdlgLayerProp.FontBold = False cdlgLayerProp.FontItalic = False cdlgLayerProp.FontStrikethru = False cdlgLayerProp.FontUnderline = False cdlgLayerProp.color = moBlack cmdApply.Enabled = True cmdOK.Enabled = True fraNOL(0).Enabled = (lyr.shapeType <> moShapeTypePolygon) Fo ri = 0 To optNOL.Count - 1 optNOL(i).Enabled = (lyr.shapeType <> moShapeTypePolygon) Next End Sub Public Sub InitZRenderer() Dim i As Integer 129 If picZRlegend.Count > 1 Then For i = (picZRlegend.Count - 1) To 1 Step -1 Unload picZRlegend(i) Unload lblZRlegend(i) Next End If picZRlegend(0).Visible = False lblZRlegend(0).Visible = False cmdApply.Enabled = False cmdOK.Enabled = False End Sub ' LoadSingleSymbol() ' LoadUniqueValues() ' LoadClassBreaks() ' LoadStandardLabels() ' LoadNoOverlapLabels() ' LoadZRenderer() Private Sub LoadSingleSymbol() Dim i As Integer Dim fnt As New StdFont cboSSP(0).Clear Select Case lyr.shapeType Case moShapeTypePoint 'set control visibility cboSSP(1).Visible = True cboSSP(2).Visible = True chkSSP.Visible = False hsbSSP.Visible = True picSSP(1).Visible = False lblSSP(3).Visible = True lblSSP(4).Visible = True lblSSP(5).Visible = True lblSSP(6).Visible = False lblSSP(7).Visible = True 'retrieve and display current values txtSSP(0).text = lyr.Symbol.Size lblSSP(0).Caption = "Marker Color:" lblSSP(2).Caption = "Size:" For i = 0 To 4 cboSSP(0).AddItem strMarkerStyle(i) Next picSSP(0).BackColor = lyr.Symbol.color cboSSP(0).text = strMarkerStyle(lyr.Symbol.Style) cboSSP(0).ListIndex = lyr.Symbol. Style hsbSSP.Value = lyr.Symbol.Rotation 130 lblSSP(7).Caption = lyr.Symbol.Rotation Iflyr.Sym bol.Style = moTrueTypeMarker Then cboSSP(1).Enabled = True cboSSP(2).Enabled = True lblSSP(3).Enabled = True lblSSP(4).Enabled = True lblSSP(5).Enabled = True lblSSP(7).Enabled = True hsbSSP.Enabled = True For i = 0 To Screen.FontCount - 1 cboSSP(1).AddItem Screen.Fonts(i) Next i cboSSP(1).text = lyr.Symbol.Font.Name For i = 0 To cboSSP(1).ListCount - 1 If cboSSP(1).List(cboSSP(1).ListIndex) = cboSSP(1).text Then cboSSP(1).ListIndex = 1 Exit For End If Next fnt.Name = cboSSP(1).text Set cboSSP(2).Font = fnt cboSSP(2).Clear For i = 0 To 255 cboSSP(2).AddItem Chr(i) Next cboSSP(2).text = lyr.Symbol.CharacterIndex cboSSP(2).ListIndex = lyr.Symbol.CharacterIndex End If Case moShapeTypeMultipoint 'set control visibility cboSSP(1).Visible = True cboSSP(2).Visible = True chkSSP.Visible = False hsbSSP.Visible = True picSSP(1).Visible = False lblSSP(3).Visible = True lblSSP(4).Visible = True lblSSP(5).Visible = True lblSSP(6).Visible = False lblSSP(7).Visible = True 'retrieve and display current values txtSSP(0).text = lyr.Symbol.Size lblSSP(0).Caption = "Marker Color:" lblSSP(2).Caption = "Size:" For i = 0 To 4 cboSSP(0).AddItem strMarkerStyle(i) Next picSSP(0).BackColor = lyr.Symbol.color cboSSP(0).text = strMarkerStyle(lyr.Symbol.Style) 131 cboSSP(0).ListIndex = lyr.Symbol.Style hsbSSP.Value = lyr.Symbol.Rotation lblSSP(7).Caption = lyr.Symbol.Rotation Iflyr.Sym bol.Style = moTrueTypeMarker Then cboSSP(1).Enabled = True cboSSP(2).Enabled = True lblSSP(3).Enabled = True lblSSP(4).Enabled = True lblSSP(5).Enabled = True lblSSP(7).Enabled = True hsbSSP.Enabled = True For i = 0 To Screen.FontCount - 1 cboSSP(1).AddItem Screen.Fonts(i) Next i cboSSP(1).text = lyr.Symbol.Font.Name For i = 0 To cboSSP(1).ListCount - 1 If cboSSP(1).List(cboSSP(1).ListIndex) = cboSSP(1).text Then cboSSP(1).ListIndex = 1 Exit For End If Next fnt.Name = cboSSP(1).text Set cboSSP(2).Font = fnt cboSSP(2).Clear For i = 0 To 255 cboSSP(2).AddItem Chr(i) Next cboSSP(2).text = lyr.Symbol.CharacterIndex cboSSP(2).ListIndex = lyr.Symbol.CharacterIndex End If Case moShapeTypeLine 'set visibility cboSSP(1).Visible = False cboSSP(2).Visible = False chkSSP.Visible = False hsbSSP.Visible = False picSSP(1).Visible = False lblSSP(3).Visible = False lblSSP(4).Visible = False lblSSP(5).Visible = False lblSSP(6).Visible = False lblSSP(7).Visible = False 'retrieve and display current values txtSSP(0).text = lyr.Symbol.Size lblSSP(0).Caption = "Line Color:" lblSSP(2).Caption = "Line width:" For i = 0 To 4 cboSSP(0).AddItem strLineStyle(i) Next 132 picSSP(0).BackColor = lyr.Symbol.color cboSSP(0).text = strLineStyle(lyr.Symbol.Style) cboSSP(0).ListIndex = lyr.Symbol. Style Case moShapeTypePolygon 'set visibility cboSSP(1).Visible = False cboSSP(2).Visible = False chkSSP.Visible = True hsbSSP.Visible = False picSSP(1).Visible = True lblSSP(3).Visible = False lblSSP(4).Visible = False lblSSP(5).Visible = False lblSSP(6).Visible = True lblSSP(7).Visible = False 'retrieve and display current values Iflyr.Sym bol.Size = 0 Then txtSSP(0).text = 1 Else txtSSP(0).text = lyr.Symbol.Size End If lblSSP(0).Caption = "F ill Color:" lblSSP(2).Caption = "Outline width:" For i = 0 To 10 cboSSP(0).AddItem strFillStyle(i) Next picSSP(0).BackColor = lyr.Symbol.color picSSP(1).BackColor = lyr.Symbol.OutlineColor cboSSP(0).text = strFillStyle(lyr.Sym bol.Style) cboSSP(0).ListIndex = lyr.Symbol. Style Select Case lyr.Symbol.Outline Case True: chkSSP.Value = 1 Case False: chkSSP.Value = 0 End Select End Select End Sub Private Sub LoadUniqueValues() Dim i As Integer Set vmr = lyr.Renderer cboUV.Clear cboUV.text = vmr.Field For i = 0 To tDesc.FieldCount - 1 cboUV.AddItem tDesc.FieldName(i) If tDesc.FieldName(i) = vmr.Field Then cboUV.ListIndex = i 133 End If Next Select Case vmr.Symbol(0).0utline Case True: chkUV.Value = 1 Case False: chkUV.Value = 0 End Select chkUV.Visible = (lyr.shapeType = moShapeTypePolygon) Call PopulateExistingUVlegend End Sub Private Sub LoadClassBreaks() Dim i, j As Integer Set cbr = lyr.Renderer j = -1 cboCB(0).Clear cboCB(0).text = cbr.Field For i = 0 To tDesc.FieldCount - 1 If tDesc.FieldType(i) = moDouble Or _ tDesc.FieldType(i) = moLong Then j =j + 1 cboCB(0).AddItem tDesc.FieldName(i) If tDesc.FieldName(i) = cbr.Field Then cboCB(0).ListIndex =j End If End If Next cboCB(1).text = cbr.BreakCount + 1 cboCB(1).ListIndex = cbr.BreakCount - 1 Select Case cbr.Symbol(0).0utline Case True chkCB.Value = 1 Case False chkCB.Value = 0 End Select picCBramp(0).BackColor = cbr.Symbol(0).color picCBramp(1).BackColor = cbr.Symbol(cbr.BreakCount).color chkCB.Visible = (lyr.shapeType = moShapeTypePolygon) Call PopulateExistingCBlegend End Sub Private Sub LoadStandardLabels() Dim i As Integer Dim strFN As String Set lr = lyr.Renderer 134 For i = 0 To tDesc.FieldCount - 1 strFN = tDesc.FieldName(i) cboSL(0).AddItem strFN If lr.Field = strFN Then cboSL(0).ListIndex = i End If If tDesc.FieldType(i) = moLong Or _ tDesc.FieldType(i) = moDouble Then cboSL(3).AddItem strFN Iflr.XO ffsetField = strFN Then cboSL(3).ListIndex = i End If cboSL(4).AddItem strFN Iflr.YO ffsetField = strFN Then cboSL(4).ListIndex = i End If End If Next Select Case lr.Symbol(0).HorizontalAlignment Case moAlignLeft cboSL(1).ListIndex = 0 Case moAlignCenter cboSL(1).ListIndex = 1 Case moAlignRight cboSL(1).ListIndex = 2 End Select Select Case lr.Symbol(0).VerticalAlignment Case moAlignTop cboSL(2).ListIndex = 0 Case moAlignCenter cboSL(2).ListIndex = 1 Case moAlignBottom cboSL(2).ListIndex = 2 End Select hsbSL.Value = lr.Symbol(0).Rotation lblSL(7).Caption = lr.Symbol(0).Rotation For i = 0 To 3 chkSL(i).Value = 0 Next If lr.DrawBackground Then chkSL(0).Value = 1 End If If lr.AllowDuplicates Then chkSL(1).Value = 1 End If If lr.SplinedText Then 135 chkSL(2).Value = 1 End If If lr.Flip Then chkSL(3).Value = 1 End If txtSL.text = lr.Symbol(0).Font.Name txtSL.ForeColor = lr.Symbol(0).color cdlgLayerProp.FontName = lr.Symbol(0).Font.Name cdlgLayerProp.FontSize = lr.Symbol(0).Font.Size cdlgLayerProp.FontBold = lr.Symbol(0).Font.Bold cdlgLayerProp.FontItalic = lr.Symbol(0).Font.Italic cdlgLayerProp.FontStrikethru = lr.Symbol(0).Font.Strikethrough cdlgLayerProp.FontUnderline = lr.Symbol(0).Font.Underline cdlgLayerProp.color = lr.Symbol(0).color End Sub Private Sub LoadNo0verlapLabels() Dim i As Integer Dim scaleHeightUnit As Double Dim strFN As String Set lp = lyr.Renderer colorMask = lp.MaskColor cboNOL.Clear For i = 0 To tDesc.FieldCount - 1 strFN = tDesc.FieldName(i) cboNOL.AddItem strFN If lp.Field = strFN Then cboNOL.ListIndex = i End If Next cdlgLayerProp.FontName = lp.DefaultSymbol.Font.Name cdlgLayerProp.FontSize = lp.DefaultSymbol.Font.Size cdlgLayerProp.FontBold = lp.DefaultSymbol.Font.Bold cdlgLayerProp.FontItalic = lp.DefaultSymbol.Font.Italic cdlgLayerProp.FontStrikethru = lp.DefaultSymbol.Font.Strikethrough cdlgLayerProp.FontUnderline = lp.DefaultSymbol.Font.Underline colorText = lp.DefaultSymbol.color TxtNOL.text = lp.DefaultSymbol.Font.Name TxtNOL.ForeColor = colorText optN0L(0).Value = lp.PlaceOn optN0L(1).Value = lp.PlaceAbove optN0L(2).Value = lp.PlaceBelow 136 Select Case lp.DrawBackground Case False: chkNOL(0).Value = 0 Case True: chkNOL(0).Value = 1 End Select Select Case lp.AllowDuplicates Case False: chkNOL(1).Value = 0 Case True: chkNOL(1).Value = 1 End Select Select Case lp.MaskLabels Case False: chkNOL(2).Value = 0 Case True chkNOL(2).Value = 1 picNOL.BackColor = lp.MaskColor End Select scaleHeightUnit = lyr.Extent.Width / 10000 hsbNOL.Value = 1000 - (lp.DefaultSymbol.Height / scaleHeightUnit) End Sub Private Sub LoadZRenderer() Dim i, j As Integer Set zRend = lyr.Renderer j = -1 cboZRclasses.Clear cboZRclasses.text = zRend.BreakCount + 1 cboZRType.ListIndex = zRend.ValueCalculation picZRramp(0).BackColor = zRend.Symbol(0).color picZRramp(1).BackColor = zRend.Symbol(zRend.BreakCount).color Call PopulateExistingZRlegend End Sub I ' ' ' ' ' ' ApplySingleSymbol() ApplyUniqueValues() ApplyClassBreaks() ApplyStandardLabels() ApplyNoOverlapLabels() ApplyZRenderer() I Private Sub ApplySingleSymbol() Dim sym As mapobjects2.Symbol Set sym = lyr.Symbol lyr.Name = txtLayerName.text 137 Set lyr.Renderer = Nothing Select Case lyr.shapeType Case moShapeTypePoint sym.color = picSSP(0).BackColor sym.Style = cboSSP(0).ListIndex If hsbSSP.Value = 0 Then sym.Rotation = 0 Else 'Clockwise instead of the default counter-clockwise sym.Rotation = 360 -hsbSSP.Value End If If IsNumeric(txtSSP(0).text) Then sym.Size = txtSSP(0).text Else sym.Size = 5 End If If sym.Style = moTrueTypeMarker Then Dim fnt As New StdFont fnt.Name = cboSSP(1).text Set sym.Font = fnt a = Asc(cboSSP(2).text) sym.CharacterIndex = Asc(cboSSP(2).text) End If Case moShapeTypeMultipoint sym.color = picSSP(0).BackColor sym.Style = cboSSP(0).ListIndex If hsbSSP.Value = 0 Then sym.Rotation = 0 Else 'Clockwise instead of the default counter-clockwise sym.Rotation = 360 -hsbSSP.Value End If If IsNumeric(txtSSP(0).text) Then sym.Size = txtSSP(0).text Else sym.Size = 5 End If If sym.Style = moTrueTypeMarker Then Dim fnt2 As New StdFont fnt2.Name = cboSSP(1).text Set sym.Font = fnt2 a = Asc(cboSSP(2).text) sym.CharacterIndex = Asc(cboSSP(2).text) End If Case moLine sym.color = picSSP(0).BackColor sym.Style = cboSSP(0).ListIndex If IsNumeric(txtSSP(0).text) Then 138 sym.Size = txtSSP(0).text Else sym.Size = 1 End If Case moPolygon sym.color = picSSP(0).BackColor sym.OutlineColor = picSSP(1).BackColor sym.Style = cboSSP(0).ListIndex If IsNumeric(txtSSP(0).text) Then sym.Size = txtSSP(0).text Else sym.Size = 1 End If Select Case chkSSP.Value Case 1 lyr.Symbol.Outline = True Case 0 lyr.Symbol.OutlineColor = lyr.Symbol.color lyr.Symbol.Outline = False End Select End Select End Sub Private Sub ApplyUniqueValues() Dim i As Integer Dim symInt As Integer If lyr.shapeType = moShapeTypeMultipoint Then symInt = 0 Else symInt = lyr.shapeType - 21 End If vmr.SymbolType = symInt If vmr.SymbolType = moFillSymbol Then For i = 0 To vmr.ValueCount - 1 Select Case chkUV.Value Case 0 vmr.Symbol(i).Outline = False vmr.Symbol(i).OutlineColor = vmr.Symbol(i).color Case 1 vmr.Symbol(i).Outline = True vmr.Symbol(i).OutlineColor = moBlack End Select Next End If Set lyr.Renderer = vmr 139 End Sub Private Sub ApplyClassBreaks() Dim i As Integer Dim symInt As Integer If lyr.shapeType = moShapeTypeMultipoint Then symInt = 0 Else symInt = lyr.shapeType - 21 End If cbr.SymbolType = symInt If cbr.SymbolType = moFillSymbol Then For i = 0 To cbr.BreakCount Select Case chkCB.Value Case 0 cbr.Symbol(i).0utlineColor = cbr.Symbol(i).color cbr.Symbol(i).0utline = False Case 1 cbr.Symbol(i).0utlineColor = moBlack cbr.Symbol(i).0utline = True End Select Next End If Set lyr.Renderer = cbr End Sub Private Sub ApplyStandardLabels() Dim fnt As New StdOle.StdFont fnt.Name = cdlgLayerProp.FontName fnt.Size = cdlgLayerProp.FontSize fnt.Bold = cdlgLayerProp.FontBold fnt.Italic = cdlgLayerProp.FontItalic fnt.Strikethrough = cdlgLayerProp.FontStrikethru fnt.Underline = cdlgLayerProp.FontUnderline Set lr = New mapobjects2.LabelRenderer lr.Field = cboSL(0).text W ith lr.Symbol(0) Select Case cboSL(1).text Case "Left" .HorizontalAlignment = moAlignLeft Case "Center" .HorizontalAlignment = moAlignCenter Case "Right" .HorizontalAlignment = moAlignRight End Select Select Case cboSL(2).text Case "Top" 140 .VerticalAlignment = moAlignTop Case "Center" .VerticalAlignment = moAlignCenter Case "Bottom" .VerticalAlignment = moAlignBottom End Select Set .Font = fnt .color = cdlgLayerProp.color 'Rotate clockwise instead of counter-clockwise IflblSL(7).Caption = 0 Then .Rotation = 0 Else .Rotation = 360 -lblSL(7).Caption End If End With W ith lr .XOffsetField = cboSL(3).text .YOffsetField = cboSL(4).text .DrawBackground = (chkSL(0).Value = 1) .AllowDuplicates = (chkSL(1).Value = 1) .SplinedText = (chkSL(2).Value =1) .Flip = (chkSL(3).Value = 1) End With Set lyr.Renderer = lr End Sub Private Sub ApplyNoOverlapLabels() Dim fnt As New StdOle.StdFont Dim scaleHeightUnit As Double Set lp = New mapobjects2.LabelPlacer lp.Field = cboNOL.text fnt.Name = cdlgLayerProp.FontName fnt.Bold = cdlgLayerProp.FontBold fnt.Italic = cdlgLayerProp.FontItalic fnt.Strikethrough = cdlgLayerProp.FontStrikethru fnt.Underline = cdlgLayerProp.FontUnderline scaleHeightUnit = lyr.Extent.Width / 10000 W ith lp.DefaultSymbol .Height = scaleHeightUnit * (1001 -hsbNOL.Value) .color = colorText Set .Font = fnt End With lp.PlaceAbove = optNOL(1) lp.PlaceBelow = optNOL(2) lp.PlaceOn = optNOL(0) 141 Select Case chkN0L(0).Value Case 0: lp.DrawBackground = False Case 1: lp.DrawBackground = True End Select Select Case chkN0L(1).Value Case 0: lp.AllowDuplicates = False Case 1: lp.AllowDuplicates = True End Select Select Case chkN0L(2).Value Case 0: lp.MaskLabels = False Case 1 lp.MaskLabels = True lp.MaskColor = picNOL.BackColor End Select Set lyr.Renderer = lp End Sub Private Sub ApplyZRenderer() Dim symInt As Integer If lyr.shapeType = moShapeTypeMultipoint Then symInt = 0 Else symInt = lyr.shapeType - 21 End If zRend.SymbolType = symInt Set lyr.Renderer = zRend End Sub I Private Sub PopulateNewUVlegend(rendField As String) Dim strsUniqueValues As New mapobjects2.Strings Dim fld As mapobjects2.Field Dim i As Integer Set fld = flds(rendField) If fld Is Nothing Then Exit Sub End If Screen.MousePointer = vbHourglass recs.MoveFirst Do While Not recs.EOF 142 strsUniqueValues.Add fld.Value recs.MoveNext Loop Screen.MousePointer = vbDefault If strsUniqueValues.Count >100 Then Dim yn As Integer yn = MsgBox("Number of unique values is greater than 100. Would you like to continue?", _ vbYesNo, "Unique values") If yn = 7 Then Exit Sub End If End If If picUV.Count > 1 Then For i = (picUV.Count - 1)To 1 Step -1 Unload picU V(i) Unload LBLu v(i) Next End If Set vmr = New mapobjects2.ValueMapRenderer vmr.Field = rendField vmr.ValueCount = strsUniqueValues.Count For i = 0 To strsUniqueValues.Count - 1 vmr.Value(i) = strsUniqueValues(i) Next FraUVouter.Caption = UCase(lyr.Name) & " - " & cboUV.text picUV(0).Visible = True LBLuv(0).Visible = True picUV(0).BackColor = vmr.Symbol(0).color LBLuv(0).Caption = vmr.Value(0) For i = 1 To vmr.ValueCount - 1 Load picU V(i) W ith picU V(i) .Left = picUV(0).Left .Width = picUV(0).Width .Height = picUV(0).Height .Top = picUV(i - 1).Top + 180 .BackColor = vmr.Symbol(i).color .Visible = True End With Load LBLu v(i) W ith LBLu v(i) .Left = LBLuv(0).Left .Width = LBLuv(0). Width .Height = LBLuv(0).Height 143 .Top = LBLu v(i - 1).Top + 180 .Caption = vmr.Value(i) .Visible = True End With Next fraUVinner.Height = (vmr.ValueCount * 180) + 250 If strsUniqueValues.Count >18 Then vsbUV.Enabled = True vsbUV.Min = 0 vsbUV.Max = vmr.ValueCount - 20 vsbUV.SmallChange = 1 vsbUV.LargeChange =10 Else vsbUV.Enabled = False End If End Sub Private Sub PopulateExistingUVlegend() If Not justOpened Then Exit Sub End If Dim recs As mapobjects2.Recordset Dim fld As mapobjects2.Field Dim i As Integer Set vmr = lyr.Renderer If picUV.Count > 1 Then For i = (picUV.Count - 1)To 1 Step -1 Unload picU V(i) Unload LBLu v(i) Next End If FraUVouter.Caption = UCase(lyr.Name) & " - " & lyr.Renderer.Field picUV(0).Visible = True LBLuv(0).Visible = True picUV(0).BackColor = vmr.Symbol(0).color LBLuv(0).Caption = vmr.Value(0) Fo ri = 1 To vmr.ValueCount - 1 Load picU V(i) W ith picU V(i) .Left = picUV(0).Left .Width = picUV(0).Width .Height = picUV(0).Height 144 .Top = picUV(i - 1).Top + 180 .BackColor = vmr.Symbol(i).color .Visible = True End With Load LBLu v(i) W ith LBLu v(i) .Left = LBLuv(0).Left .Width = LBLuv(0). Width .Height = LBLuv(0).Height .Top = LBLu v(i - 1).Top + 180 .Caption = vmr.Value(i) .Visible = True End With Next fraUVinner.Height = (vmr.ValueCount * 180) + 300 If vmr.ValueCount >18 Then vsbUV.Enabled = True vsbUV.Min = 0 vsbUV.Max = vmr.ValueCount - 20 vsbUV.SmallChange = 1 vsbUV.LargeChange =10 Else vsbUV.Enabled = False End If justOpened = False End Sub Private Sub PopulateNewCBlegend(rendField As String) Dim stats As mapobjects2.Statistics Dim range As Double Dim i, numClasses, numBreaks As Integer If Trim(cboCB(0).text) = vbNullString Then cboCB(0).ListIndex = 0 End If Set stats = recs.CalculateStatistics(cboCB(0).text) numClasses = cboCB(1).text numBreaks = numClasses - 1 If picCBlegend.Count > 1 Then For i = (picCBlegend.Count - 1) To 1 Step -1 Unload picCBlegend(i) Unload lblCBlegend(i) 145 Next End If Set cbr = New mapobjects2.ClassBreaksRenderer cbr.Field = cboCB(0).text cbr.BreakCount = numBreaks range = stats.Max - stats.Min For i = 0 To numBreaks - 1 cbr.Break(i) = stats.Min + ((range / numClasses) * (i + 1)) Next cbr.RampColors picCBramp(0).BackColor, picCBramp(1).BackColor fraCB.Caption = UCase(lyr.Name) & " - " & cboCB(0).text picCBlegend(0).Visible = True lblCBlegend(0).Visible = True picCBlegend(0).BackColor = cbr.Symbol(0).color lblCBlegend(0).Caption = "Less than " & Format(cbr.Break(0), "#0.00") Fo ri = 1 To cbr.BreakCount Load picCBlegend(i) W ith picCBlegend(i) .Left = picCBlegend(0).Left .Width = picCBlegend(0). Width .Height = picCBlegend(0).Height .Top = picCBlegend(i - 1).Top + 180 .BackColor = cbr.Symbol(i).color .Visible = True End With Load lblCBlegend(i) W ith lblCBlegend(i) .Left = lblCBlegend(0).Left .Width = lblCBlegend(0). Width .Height = lblCBlegend(0).Height .Top = lblCBlegend(i - 1).Top +180 .Visible = True Select Case i Case cbr.BreakCount .Caption = ">= " & Format(cbr.Break(cbr.BreakCount - 1), "#0.00") Case Else .Caption = Format(cbr.Break(i - 1), "#0.00") & " - " & Format(cbr.Break(i), "#0.00") End Select End With Next End Sub 146 Public Sub PopulateExistingCBlegend() If Not justOpened Then Exit Sub End If Dim stats As mapobjects2.Statistics Dim i, numClasses, numBreaks As Integer Set stats = recs.CalculateStatistics(lyr.Renderer.Field) numBreaks = lyr.Renderer.BreakCount If picCBlegend.Count > 1 Then For i = (picCBlegend.Count - 1) To 1 Step -1 Unload picCBlegend(i) Unload lblCBlegend(i) Next End If Set cbr = lyr.Renderer cbr.Field = lyr.Renderer.Field fraCB.Caption = UCase(lyr.Name) & " - " & cboCB(0).text picCBlegend(0).Visible = True lblCBlegend(0).Visible = True picCBlegend(0).BackColor = cbr.Symbol(0).color lblCBlegend(0).Caption = "Less than " & Format(cbr.Break(0), "#0.00" Fo ri = 1 To cbr.BreakCount Load picCBlegend(i) W ith picCBlegend(i) .Left = picCBlegend(0).Left .Width = picCBlegend(0). Width .Height = picCBlegend(0).Height .Top = picCBlegend(i - 1).Top + 180 .BackColor = cbr.Symbol(i).color .Visible = True End With Load lblCBlegend(i) W ith lblCBlegend(i) .Left = lblCBlegend(0).Left .Width = lblCBlegend(0). Width .Height = lblCBlegend(0).Height .Top = lblCBlegend(i - 1).Top +180 .Visible = True Select Case i Case cbr.BreakCount .Caption = ">= " & Format(stats.Max, "#0.00") Case Else 147 .Caption = Format(cbr.Break(i - 1), "#0.00") & " - " & Format(cbr.Break(i), "#0.00") End Select End With Next justOpened = False End Sub Private Sub PopulateNewZRLegend() Dim n As Integer Dim range As Double Dim MinZ As Double, MaxZ As Double MinZ = lyr.Extent.Floor MaxZ = lyr.Extent.Ceiling MaxZ = 1400 range = MaxZ -MinZ ' clear existing legend If picZRlegend.Count > 1 Then For n = (picZRlegend.Count - 1) To 1 Step -1 Unload picZRlegend(n) Unload lblZRlegend(n) Next End If ' set new breakcount Set zRend = New mapobjects2.ZRenderer zRend.BreakCount = cboZRclasses.List(cboZRclasses.ListIndex) - 1 ' Set the breaks using simple equal interval ranges... For n = 1 To zRend.BreakCount zRend.Break(n - 1) = MinZ + ((range / zRend.BreakCount + 1) * (n)) Next n 'Build symbol array by ramping start and end colors zRend.RampColors picZRramp(0).BackColor, picZRramp(1).BackColor ' handle the base items in the object arrays picZRlegend(0).BackColor = picZRramp(0).BackColor lblZRlegend(0).Caption = "Less Than " & Format(zRend.Break(0), "#0.00") picZRlegend(0).Visible = True lblZRlegend(0).Visible = True For n = 1 To zRend.BreakCount ' Set up the color boxes Load picZRlegend(n) 148 W ith picZRlegend(n) .Top = picZRlegend(n - 1).Top + 180 .BackColor = zRend.Symbol(n).color .Visible = True End With ' Set up the labels Load lblZRlegend(n) W ith lblZRlegend(n) .Top = lblZRlegend(n - 1).Top + 180 .Visible = True Select Case n Case zRend.BreakCount .Caption = "Greater Than " & Format(zRend.Break(n - 1), "#0.00") Case Else .Caption = Format(zRend.Break(n - 1), "#0.00") & " - " & Format(zRend.Break(n), "#0.00") End Select End With Next n End Sub Private Sub PopulateExistingZRlegend() If Not justOpened Then Exit Sub End If Dim stats As mapobjects2.Statistics Dim i, numClasses, numBreaks As Integer Set zRend = lyr.Renderer If picZRlegend.Count > 1 Then For i = (picZRlegend.Count - 1) To 1 Step -1 Unload picZRlegend(i) Unload lblZRlegend(i) Next End If picZRlegend(0).Visible = True lblZRlegend(0).Visible = True picZRlegend(0).BackColor = zRend.Symbol(0).color lblZRlegend(0).Caption = "Less than " & Format(zRend.Break(0), "#0.00") For i = 1 To zRend.BreakCount Load picZRlegend(i) W ith picZRlegend(i) .Left = picZRlegend(0).Left .Width = picZRlegend(0).Width 149 .Height = picZRlegend(0).Height .Top = picZRlegend(i - 1).Top + 180 .BackColor = zRend.Symbol(i).color .Visible = True End With Load lblZRlegend(i) W ith lblZRlegend(i) .Left = lblZRlegend(0).Left .Width = lblZRlegend(0). Width .Height = lblZRlegend(0).Height .Top = lblZRlegend(i - 1).Top +180 .Visible = True Select Case i Case zRend.BreakCount .Caption = ">= " & Format(stats.Max, "#0.00") Case Else .Caption = Format(zRend.Break(i - 1), Format(zRend.Break(i), "#0.00") End Select End With Next justOpened = False End Sub "#0.00") & " - " & 150 A P P EN D IX D Form Vessel Location Option Explicit Private mVessels As CVessels Private mstrKey As String 'Holds form's key property Private mstrAction As String 'Holds form's Action property Private Sub cmdCancel Click() 'Return to main from with no action frmVesselLocation.Hide End Sub Private Sub cmdDisplay Click() Dim X As Double Dim Y As Double Const Xmin = 103.6 Const Xmax = 104.6 Const Ymin =1.3 Const Ymax = 1.45 Dim TheIndex As Long Dim VesselName As String X = Val(txtX) Y = Val(txtY) VesselName = Trim(txtVesselName) If X < Xmin Or X > Xmax Or Y < Ymin Or Y > Ymax Then MsgBox "The provided coordinates are out of the area.", vbExclamation txtX.SetFocus Exit Sub ElseIf VesselName = "" Then MsgBox "Please Enter vessel Name.", vbExclamation txtV esselName. SetFocus Exit Sub Else TheIndex = UBound(Vessel) + 1 151 ReDim Preserve Vessel(TheIndex) Vessel(TheIndex).X = X Vessel(TheIndex).Y = Y Vessel(TheIndex).VesselName = VesselName Vessel(TheIndex).IsShow = True lstVessels.AddItem Vessel(TheIndex).VesselName & vbTab Vessel(TheIndex).X & vbTab & "Y=" & Vessel(TheIndex).Y lstVessels.Selected(TheIndex - 1) = True End If & "X=" & End Sub Private Sub cmdHide_Click() Me.Hide End Sub Private Sub cmdDelete_Click() Dim i As Long Dim TheSelectedIndex As Long If lstVessels.SelCount <= 0 Then MsgBox "Please select one Item first." Exit Sub End If TheSelectedIndex = lstVessels.ListIndex For i = TheSelectedIndex + 1 To UBound(Vessel, 1) - 1 Vessel(i) = Vessel(i +1) Next i ReDim Preserve Vessel(UBound(Vessel, 1) - 1) lstVessels.RemoveItem TheSelectedIndex frmMain.map.Refresh End Sub Private Sub cm d0K_Click() 'Choose action depending upon the action setting Dim strName As String Dim strKey As String Select Case mstrAction Case "A " 'Addvessel 'Add to listbox and set itemdata to new object's key strName = txtVesselName.text & "," & txtTypeVessel.text W ith frmVesselmain.lstVessel .AddItem strName strKey = mVessels.NextVesselCode .ItemData(.NewIndex) = Val(strKey) End With 'Add Vessel object to collection, setting the key mVessels.Add txtVesselName.text, txtTypeVessel.text, txtChief.text, txtCrew.text, txtX.text, txtY.text, strKey Case "R " 'Remove vessel 152 'Remove from list box W ith frmVesselmain.lstVessel .RemoveItem.ListIndex End With 'remove from collection mVessels.Remove mstrKey End Select 'Return to frmVesselMain frmVesselLocation.Hide End Sub Private Sub Form_Load() Me.Move 1000, 3000 'Default to today's date txtDate = Date 'Create the vessel collection object Set mVessels = New CVessels End Sub Private Sub Form_Activate() 'set up the from for the selcted action Select Case mstrAction Case "A " lblcommand.Caption = "Add New Vessel info" ClearTextBoxes txtVesselName.SetFocus Case "R" lblcommand.Caption = "Remove this record" DisplayData Case "D" lblcommand.Caption = "Vessel info Display" DisplayData End Select End Sub Private Sub lstVessels_ItemCheck(Item As Integer) Vessel(Item + 1).IsShow = lstVessels.Selected(Item) frmMain.map.Refresh End Sub 'Let user select date from frmCalendar Private Sub cmdCalendar_Click() Dim UserDate As Date UserDate = CVDate(txtDate) If frmCalendar.GetDate(UserDate) Then txtDate = UserDate End If End Sub 153 Private Sub Form_Unload(Cancel As Integer) 'Remove the vessel collection object from memory Set mVessels = Nothing End Sub Private Sub DisplayData() 'transfer from the collection to text field W ith mVessels.Item(mstrKey) txtVesselName.text = .VesselName txtTypeVessel.text = .TypeVessel txtChief.text = .Chief txtCrew.text = .Crew txtX.text = .X txtY.text = .Y End With End Sub Public Sub ClearTextBoxes() 'Clear all the textboxes txtVesselName.text = "" txtTypeVessel.text = "" txtChief.text = "" txtCrew.text = "" txtX.text = "" txtY.text = "" End Sub Public Property Let Key(ByVal strKey As String) 'Assign the key property mstrKey = strKey End Property Public Property Let Action(ByVal strAction As String) 'Assign the Action Property mstrAction = strAction End Property 154 Form Vessel M ain Private Sub cmdAdd_Click() W ith frmVesselLocation .Action = "A " .Show vbModal End With End Sub Private Sub cmdDisplay_Click() If lstVessel.ListIndex <> -1 Then With frmVesselLocation .KeyPreview = Trim(Str(lstVessel.ItemData(lstVessel.ListIndex))) .Action = "D" .Show vbModal End With Else MsgBox "Please select name from list" End If End Sub Private Sub cmdExit_Click() 'terminate the project Unload frmVesselLocation Unload Me End End Sub Private Sub cmdRemove_Click() 'display the vessel data from with selected vessel for delete If lstVessel.ListIndex <> -1 Then W ith frmVesselLocation .KeyPreview = Trim(Str(lstVessel.ItemData(lstVessel.ListIndex))) .Action = "R" .Show vbModal End With Else MsgBox "Please select name from list" End If End Sub Form Calendar 155 Option Explicit 'Grid dimensions for days Private Const G R ID R O W S = 6 Private Const G R ID C O LS = 7 'Private variables Private m CurrDate As Date, mbAcceptChange As Boolean Private m nGridW idth As Integer, m nGridHeight As Integer 'Public function: If user selects date, sets UserDate to selected 'date and returns True. Otherwise, returns False. Public Function GetDate(UserDate As Date, Optional Title) As Boolean 'Store user-specified date m CurrDate = UserDate 'Use caller-specified caption if any If Not IsMissing(Title) Then Caption = Title End If 'Display this form Me.Show vbModal 'Return selected date If m bAcceptChange Then UserDate = m CurrDate End If 'Return value indicates if date was selected GetDate = mbAcceptChange End Function 'Form initialization Private Sub Form_Load() 'Calculate calendar grid measurements m nGridW idth = ((picMonth.ScaleWidth G R ID C O LS) m nGridHeight = ((picMonth.ScaleHeight G R ID R O W S) mbAcceptChange = False End Sub - Screen.TwipsPerPixelX) \ - Screen.TwipsPerPixelY) \ 'Process user keystrokes Private Sub picMonth_KeyDown(KeyCode As Integer, Shift As Integer) Dim NewDate As Date Select Case KeyCode Case vbKeyRight NewDate = DateAdd("d", 1, m CurrDate) Case vbKeyLeft NewDate = DateAdd("d", -1, m CurrDate) Case vbKeyDown 156 NewDate = DateAdd("ww", 1, m CurrDate) Case vbKeyUp NewDate = DateAdd("ww", -1, m CurrDate) Case vbKeyPageDown NewDate = DateAdd("m", 1, m CurrDate) Case vbKeyPageUp NewDate = DateAdd("m", -1, m CurrDate) Case vbKeyReturn mbAcceptChange = True Unload Me Exit Sub Case vbKeyEscape Unload Me Exit Sub Case Else Exit Sub End Select SetNewDate NewDate KeyCode = 0 End Sub 'Double-click accepts current date Private Sub picMonth_DblClick() mbAcceptChange = True Unload Me End Sub ' Select the date by mouse Private Sub picMonth_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim i As Integer, MaxDay As Integer 'Determine which date is being clicked i = Weekday(DateSerial(Year(m_CurrDate), Month(m CurrDate), 1)) - 1 i = (((x \ m nGridWidth) + 1) + ((y \ m nGridHeight) * GRID CO LS)) - i 'Get last day of current month MaxDay = Day(DateAdd("d", -1, DateSerial(Year(m_CurrDate), Month(m_CurrDate) + 1, 1 ))) If i >= 1 And i <= MaxDay Then SetNewDate DateSerial(Year(m_CurrDate), Month(m CurrDate), i) End If End Sub 'Click on ">>" goes to next month Private Sub lblNext_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button And vbLeftButton Then SetNewDate DateAdd("m", 1, m CurrDate) End If End Sub 157 'Double-click has same effect Private Sub lblNext_DblClick() SetNewDate DateAdd("m", 1, m CurrDate) End Sub 'Click on "<<" goes to previous month Private Sub lblPrev_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button And vbLeftButton Then SetNewDate DateAdd("m", -1, m CurrDate) End If End Sub 'Double-click has same effect Private Sub lblPrev_DblClick() SetNewDate DateAdd("m", -1, m CurrDate) End Sub 'Changes the selected date Private Sub SetNewDate(NewDate As Date) If Month(mCurrDate) = Month(NewDate) Year(NewDate) Then DrawSelectionBox False m CurrDate = NewDate DrawSelectionBox True Else m CurrDate = NewDate picMonth_Paint End If End Sub And Year(m CurrDate) = 'Here's the calendar paint handler; displayes the calendar days Private Sub picMonth_Paint() Dim i As Integer, j As Integer, x As Integer, y As Integer Dim NumDays As Integer, CurrPos As Integer, bCurrMonth As Boolean Dim MonthStart As Date, buffer As String 'Determine if this month is today's month If Month(m CurrDate) = Month(Date) And Year(m CurrDate) = Year(Date) Then bCurrMonth = True End If 'Get first date in the month MonthStart = DateSerial(Year(m_CurrDate), Month(m CurrDate), 1) 'Number of days in the month NumDays = DateDiff("d", MonthStart, DateAdd("m", 1, MonthStart)) 'Get first weekday in the month (0 -based) j = Weekday(MonthStart) - 1 'Tweak for 1-based For/Next index j =j - 1 158 'Show current month/year lblMonth = Format$(m_CurrDate, "mmmm yyyy") 'Clear existing data picMonth.Cls 'Display dates for current month For i = 1 To NumDays CurrPos - i +j x = (CurrPos Mod G R ID C O LS) * m nGridW idth y = (CurrPos \ GRID CO LS) * mnGridHeight 'Show date as bold if today's date IfbCurrMonth And i = Day(Date) Then picMonth.Font.Bold - True Else picMonth.Font.Bold - False End If 'Center date within "date cell" buffer = CStr(i) picMonth.CurrentX - x + ((m_nGridWidth -picMonth.TextWidth(buffer)) / 2) picMonth.CurrentY - y + ((m_nGridHeight -picMonth.TextHeight(buffer)) / 2) 'Print date picMonth.Print buffer; Next i 'Indicate selected date DrawSelectionBox True End Sub 'Draw or clears the selection box around the current date Private Sub DrawSelectionBox(bSelected As Boolean) Dim clrTopLeft As Long, clrBottomRight As Long Dim i As Integer, x As Integer, y As Integer 'Set highlight and shadow colors If bSelected Then clrTopLeft = vbButtonShadow clrBottomRight = vb3DHighlight Else clrTopLeft = vbButtonFace clrBottomRight - vbButtonFace End If 'Compute location for current date i = Weekday(DateSerial(Year(m_CurrDate), Month(m CurrDate), 1)) - 1 i = i + (Day(m_CurrDate) - 1) x - (i Mod GRID CO LS) * m nGridWidth y - (i \ GRID CO LS) * m nGridHeight 'Draw box around date picMonth.Line (x, y + m_nGridHeight)-Step(0, -m nGridHeight), clrTopLeft picMonth.Line -Step(m_nGridWidth, 0), clrTopLeft picMonth.Line -Step(0, m nGridHeight), clrBottomRight picMonth.Line -Step(-m_nGridWidth, 0), clrBottomRight 159 End Sub Form M edical A ssisted Option Explicit Dim Recs2() As mapobjects2.Recordset Private Sub EnableTextBox(LockIt As Boolean) txtname.Locked = IIf(LockIt, True, False) txtadd.Locked = IIf(LockIt, True, False) txtstate.Locked = IIf(LockIt, True, False) txtcity.Locked = IIf(LockIt, True, False) txtZipcode.Locked = IIf(LockIt, True, False) txtcontact.Locked = IIf(LockIt, True, False) End Sub Private Sub cmdAdd_Click() 'Add new data If cmdAdd.Caption = "Add" Then AdoMedical.Recordset.AddNew txtname.SetFocus DisableButtons cmdSave.Enabled = True cmdAdd.Caption = "cancel" Else AdoMedical.Recordset.Cancel EnableButtons cmdSave.Enabled = False cmdAdd.Caption = "Add" End If End Sub Private Sub cmdClose_Click() 'Close frmMedicalAssited 160 Me.Hide End Sub Private Sub cmdNext_Click() 'Move to next record W ith AdoMedical.Recordset .MoveNext If.E O F Then .MoveFirst End If End With End Sub Private Sub cmdPrevious_Click() 'Move to Previous record W ith AdoMedical.Recordset .MovePrevious If.B O F Then .MoveLast End If End With End Sub Private Sub EnableButtons() 'Enable navigation button cmdNext.Enabled - True cmdPrevious.Enabled - True cmdClose.Enabled - True cmdAdd.Enabled - True 161 cmdSave.Enabed = True End Sub Private Sub DisableButtons() 'Disable navigation button cmdNext.Enabled = False cmdPrevious.Enabled = False cmdClose.Enabled = False cmdAdd.Enabled = False cmdSave.Enabled = False End Sub Private Sub cmdSave_Click() 'Save the current data AdoMedical.Recordset.Update EnableButtons cmdSave.Enabled = False cmdAdd.Caption = "Add" End Sub Form Fire & Rescue Option Explicit Dim Recs2() As mapobjects2.Recordset Private Sub cmdAdd_Click() 'Add new data If cmdAdd.Caption = "Add" Then Adodc1.Recordset.AddNew txtName.SetFocus 162 DisableButtons cmdSave.Enabled - True cmdAdd.Caption - "cancel" Else Adodc1.Recordset.Cancel EnableButtons cmdSave.Enabled - False cmdAdd.Caption - "Add" End If End Sub Private Sub cmdClose_Click() 'Close frmMedicalAssited Me.Hide End Sub Private Sub cmdNext_Click() 'Move to next record W ith Adodc1.Recordset .MoveNext If.E O F Then .MoveFirst End If End With End Sub Private Sub cmdPrevious_Click() 'Move to Previous record W ith Adodc1.Recordset .MovePrevious If.B O F Then 163 .MoveLast End If End With End Sub Private Sub EnableButtons() 'Enable navigation button cmdNext.Enabled = True cmdPrevious.Enabled = True cmdClose.Enabled = True cmdAdd.Enabled = True cmdSave.Enabed = True End Sub Private Sub DisableButtons() 'Disable navigation button cmdNext.Enabled = False cmdPrevious.Enabled = False cmdClose.Enabled = False cmdAdd.Enabled = False cmdSave.Enabled = False End Sub Private Sub cmdSave_Click() 'Save the current data Adodc 1.Recordset.Update EnableButtons cmdSave.Enabled = False cmdAdd.Caption = "Add" End Sub 164 A P PEN D IX E Module Option Explicit Public grp renderer depth As New mapobjects2.GroupRenderer Public Type VesselType x As Double y As Double VesselName As String IsShow As Boolean End Type Public Vessel() As VesselType Public TheLabelPoint As New mapobjects2.Point Sub addShapeFile(basepath As String, ByVal shpfile As String, layerName As String, the map As mapobjects2.map) Dim dCon As New DataConnection Dim gSet As GeoDataset Dim strShapefileType As String dCon.Database - basepath If dCon.Connect Then shpfile - Left(shpfile, Len(shpfile) -4) 'Extract suffix of shpfile string Set gSet - dCon.FindGeoDataset(shpfile) 'Find shapefile as GeoDataset in DataConnection 'gSet.AllowSharing - True If gSet Is Nothing Then MsgBox "Error opening shapefile " & shpfile, vbCritical Exit Sub Else If gSet.HasZ Then strShapefileType - "[SH A PEFILZ ]" Else strShapefileType - "[SH A P EFILE]" End If Dim newLayer As New MapLayer newLayer.GeoDataset - gSet 'Set GeoDataset property of new MapLayer newLayer.Name - layerName 'Set Name property of new MapLayer 165 newLayer.Tag = strShapefileType & dCon.Database & "|" newLayer.Name the_map.Layers.Add newLayer 'Add MapLayer to Layers collection End If Else MsgBox "Connection error", vbCritical, "Connection error" End If End Sub Sub ExitApplication() Dim frm As Form For Each frm In Forms Unload frm Set frm = Nothing Next frm Set frm = Nothing End End Sub Function GetMapScale(map As mapobjects2.map) As Double Const INCH2M ETERS = 39.37 Dim mapScreenWidth As Double Dim mapExtentWidth As Double Dim tmpRect As New mapobjects2.Rectangle Dim convFactor As Double Dim mapScale As Double mapScreenWidth = map.Width / 1440 mapExtentWidth = map.Extent.Width * INCH2M ETERS mapScale = Round(mapExtentWidth /mapScreenWidth) GetMapScale = mapScale End Function 'CenterForm - Centers a form Public Sub CenterForm(frm As Form) 'Center the form frm.Top = (Screen.Height - frm.Height) \ 2 frm.Left = (Screen.Width - frm.Width) \ 2 End Sub 'HiliteText - Hilights the contents of a text control Public Sub HiliteText(Ctrl As Control) Ctrl.SelStart = 0 Ctrl.SelLength = Len(Ctrl) End Sub ' SplitPath - splits a path into dir name and filename w/out extension Sub SplitPath(pathName As String, dirName As String, fileName As String) ' find the last occurance of a file separator ' in the path Dim nCurPos As Integer, nLastPos As Integer & 166 Do nLastPos - nCurPos nCurPos - InStr(nCurPos + 1, pathName, "\") Loop Until nCurPos - 0 If nLastPos - 0 Then Exit Sub Dim fname As String dirName - Left(pathName, nLastPos - 1) fname - Right(pathName, Len(pathName) -nLastPos) fileName - Left(fname, Len(fname) - 4) End Sub Vessel Class Module Option Explicit Private mstrVesselName As String Private mstrTypeVessel As String Private mstrChief As String Private mstrCrew As String Private mstrX As String Private mstrY As String Private mstrVesselCode As String Public Property Get VesselName() As String 'Retrieve current value VesselName - mstrVesselName End Property Public Property Let VesselName(ByVal strVesselName As String) 'Assign the property value mstrVesselName - strVesselName End Property Public Property Get TypeVessel() As String 'Retrieve current value TypeVessel - mstrTypeVessel End Property Public Property Let TypeVessel(ByVal strTypeVessel As String) 'Assign the property value mstrTypeVessel - strTypeVessel End Property Public Property Get Chief() As String 'Retrieve current value 167 Chief = mstrChief End Property Public Property Let Chief(ByVal strChief As String) 'Assign the property value mstrChief = strChief End Property Public Property Get Crew() As String 'Retrieve current value Crew = mstrCrew End Property Public Property Let Crew(ByVal strCrew As String) 'Assign the property value mstrCrew = strCrew End Property Public Property Get X () As String 'Retrieve current value X = mstrX End Property Public Property Let X (ByV al strX As String) 'Assign the property value mstrX = strX End Property Public Property Get Y () As String 'Retrieve current value Y = mstrY End Property Public Property Let Y (ByV al strY As String) 'Assign the property value mstrY = strY End Property Public Property Get VesselCode() As String 'Retrieve the current value VesselCode = mstrVesselCode End Property 168 Public Property Let VesselCode(ByVal strVesselCode As String) 'Assign the property value mstrVesselCode - strVesselCode End Property Vessel Location Class Module Option Explicit Private mVessels As Collection Public Sub Add(ByVal strVesselName As String, ByVal strTypeVessel As String, ByVal strChief As String, ByVal strCrew As String, ByVal strX As String, ByVal strY As String, ByVal strVesselCode As String) 'Add a member to the collection Dim NewVessel As New CVessels WithNewVessel .VesselCode - strVesselCode .VesselName - strVesselName .TypeVessel - strTypeVessel .Chief - strChief .Crew - strCrew .X - strX .Y - strY mVessels.Add NewVessel, .VesselCode End With End Sub Public Sub Rem ove(ByVal strKey As String) 'Remove a member from the collection mVessels.Remove strKey End Sub Public Function Item (ByVal strKey As String) As CVessels 'Select a member from the collection Set Item - mVessels.Item(strKey) End Function Public Sub Class_Initialize() 'Create the collection object Set mVessels - New Collection End Sub 169 Public Sub Class_Terminate() 'Remove the collection from memory Set mVessels = Nothing End Sub Public Function NextVesselCode() As String 'Find next availabe code Static intVesselCode As Integer intVesselCode = intVesselCode + 1 NextVesselCode = Trim(Str(intVesselCode)) End Function Public Property Get Count() As Long 'Find the number of members in the collection Count = mVessels.Count End Property Public Function NewEnum() 'Allow for the For Each..Next enumeration Set NewEnum = mVessels.[_NewEnum] End Function 170 A P PEN D IX F Feedback Form 1. We are interested in your comment and suggestions. Please take a few minutes to answer the following question. The result of this evaluation w ill be used for future development of this system. 2. Did this system meet your expectation in the following areas: Usefulness of the system Difficulty in navigating the system Time required to navigate the system The quality of the system Is this system user friendly Overall satisfaction with this system 3. Definitely Definitely No Yes □□ □□ □□ □□ □□ □□ 1 2 1 2 1 2 1 2 1 2 1 2 □ □ □ □ □ □ 3 3 3 3 3 3 □ □ □ □ □ □ 4 4 4 4 4 4 □ □ □ □ □ □ 5 5 5 5 5 5 In your opinion, what do you think about Maritime Rescue Application System? 171 4. Please give a comment or suggestions regarding in upgrade the Maritime Rescue Application System. THAME YOUFOR YOUR CO-OPERATION