Русские Блоги
Это первое руководство из серии World Wind Web, в которой, в основном, представлено простое приложение World Wind Web. Позже, по мере развития проекта, он будет обновляться одно за другим.
1. Представьте worldwind.js
Создайте новую HTML-страницу и представьте библиотеку worldwind.js
2. Добавьте один на страницу <canvas> Область холста и установите размер его области.
3. Визуализируйте слои и управляйте слоями в JavaScript.
4. Отображение визуализации
Интеллектуальная рекомендация
Реализация JavaScript Hashtable
причина Недавно я смотрю на «Структуру данных и алгоритм — JavaScript», затем перейдите в NPMJS.ORG для поиска, я хочу найти подходящую ссылку на библиотеку и записывать его, я могу исполь.
MySQL общие операции
jdbc Транзакция: транзакция, truncate SQL заявление Transaction 100 000 хранимая процедура mysql msyql> -определить новый терминатор,Пробелов нет mysql>delimiter // mysql> -создание хранимой .
Используйте Ansible для установки и развертывания TiDB
жизненный опыт TiDB — это распределенная база данных. Настраивать и устанавливать службы на нескольких узлах по отдельности довольно сложно. Чтобы упростить работу и облегчить управление, рекомендуетс.
Последняя версия в 2019 году: использование nvm под Windows для переключения между несколькими версиями Node.js.
С использованием различных интерфейсных сред вы можете переключаться между разными версиями в любое время для разработки. Например, развитие 2018 года основано наNode.js 7x версия разработана. Тебе эт.
Шаблон проектирования — Создать тип — Заводской шаблон
Заводская модель фабрикиPattern Решать проблему: Решен вопрос, какой интерфейс использовать принципСоздайте интерфейс объекта, класс фабрики которого реализуется его подклассом, чтобы процесс создания.
NASA WorldWind
WorldWind is a collection of components that interactively display 3D geographic information within Java applications. Applications use WorldWind by placing one or more WorldWindow components in their user interface. The WorldWind components are extensible. The API is defined primarily by interfaces, so components can be selectively replaced by alternative components.
WorldWindow is an interface. Toolkit-specific implementations of the interface are provided for Swing/AWT and, in the future, SWT-Eclipse. See WorldWindowGLCanvas .
In addition to WorldWindow , there are five major WorldWind interfaces. They are:
-
— represents a planet’s shape and terrain. — applies imagery or information to a Globe . — aggregates a Globe and the Layer s to apply to it. — controls the rendering of a Model . — interactively controls the user’s view of the model.
In typical usage, applications associate a Globe and several Layer s with a Model They then pass that model to a SceneController that displays the globe and its layers in a WorldWindow . The scene controller subsequently manages the display of the globe and its layers in conjunction with an interactive View that defines the user’s view of the planet.
The objects implementing the above interfaces may be those provided by WorldWind or those created by application developers. Objects implementing a particular interface may be used wherever that interface is called for. World Wind provides several Globe objects representing Earth, Mars and the Earth’s moon, and provides basic implementations of Model , SceneController and View .
Most of WorldWind’s components are defined by interfaces. This allows application developers to create their own implementations and easily integrate them into WorldWind.
The WorldWind Class
Multiple WorldWind Windows
Data Retrieval
WorldWind works with enormous quantities of data and information, all of which exist primarily on remote data servers. Retrieval and local caching of that data is therefore a primary feature of WorldWind. The classes that implement retrieval are Retriever and RetrievalService .
Retriever encapsulates a single network retrieval request. It is an interface. The most commonly used concrete Retriever is HTTPRetriever , which retrieves data via http. Retrievers are typically created by a Layer to retrieve the data the layer displays, and by an ElevationModel to retrieve elevation data.
RetrievalService manages a thread pool for retrieval tasks. Objects retrieve data by passing the retrieval service a Retriever . The service runs each retriever in an individual thread. Access to the retrieval service is through WorldWind , which holds a singleton instance.
When a retriever’s data arrives, the retrieval service calls the retriever’s RetrievalPostProcessor , which was specified to the retriever’s constructor. The RetrievalPostProcessor is passed the data immediately upon download and determines how to persist it. Persistence and any processing prior to it is object specific. TiledImageLayer , for instance, can convert non-DDS formats to DDS, or simply store the data as-is in the file cache. BasicElevationModel just persists the raw data. The post processor runs in the same thread as the retriever, which is neither the event-dispatching (UI) thread nor the rendering thread, but the one created by the retrieval service for that retriever.
Data that has been previously retrieved or is otherwise local (on disk) is brought into memory in a thread separate from the event-dispatching thread or the rendering thread. One of the WorldWind conventions is that no code may access the computer’s disk in any way during rendering. Therefore loading the data from disk is dispatched to another thread pool, the ThreadedTaskService . This service has a similar interface to RetrievalService. Tasks it runs typically read the data from disk and add it to the global memory cache (described below).
One consequence of the disk-access restriction is that determining whether needed data is on disk and can be loaded directly, or is not local and therefore must be retrieved, must not be done in the rendering thread. (A disk access is necessary to determine whether the data exists locally.) Objects that load data therefore follow the convention of first checking the memory cache for the desired data, and if it’s not there create a Runnable to determine in a separate thread where the data must be drawn from, disk or network. If it’s on the disk then the task can simply read it and cache it right away. If it’s remote then the task creates a Retriever and requests retrieval. Later, after retrieval has placed the data on disk, the situation will be the local case and data can be loaded into memory within the Runnable .
Memory Cache
So that data can be shared among caching objects, most cached data used within WorldWind is cached in a MemoryCache . MemoryCache enable cached data to be shared among all WorldWindWindow instantiations in an application. Thus two Earth globes each displayed in a separate window will share any image or elevation tiles that they are using simultaneously. The same would be true of any place name collections. The constraint this imposes is that cached data that is to be shared must base equals() and hashCode() on fields that are not instance specific to the caching object.
File Cache
All data persisted to or drawn from the local computer is done so by the FileStore No object manages its own storage. The file cache cache manages multiple disk storage locations and unifies access to them. The file cache is a singleton, accessible through the WorldWind singleton.
Picking and Selection
WorldWind can determine the displayed objects at a given screen position in a WorldWindow . When the application wants to know what’s displayed at a particular point, say the cursor position, it calls a method on WorldWindow that accepts the point and returns a description of what’s drawn there. In general the application specifies a pick region rather than a single point, with the region a few pixels wide and high and centered on the point. This provides a pick tolerance and allows the user to indicate something close to but not exactly at the screen position. Since several objects may intersect the pick region, descriptions of all these objects are returned to the application. Which of these objects are meaningful is determined by the application.
WorldWind uses a method similar to drawing to detect objects in the pick region. During picking, the frame controller invokes each layer’s AbstractLayer.doPick(DrawContext, java.awt.Point) . As in drawing, the methods are invoked in turn, according to the layer’s position in the model’s layer list. During the call, each layer is responsible for determining which of its items, if any, are picked. Prior to traversing the layer list, the frame controller sets the current view’s viewport to the pick region specified by the application. When a layer identifies an object that intersects that pick region, it adds a description of that object to the draw context’s pick list. Once all layers are traversed, the list of picked items is returned to the application.
It’s typically not straightforward for a layer to determine which of its contents intersect a screen-space pick region. To do that usually requires transforming the screen point into model coordinates and determining intersection in that coordinate system. But depth values are ambiguous with only a two-dimensional screen point as input, complicating transformation to model coordinates, and geometric intersection determination can be very difficult and time consuming. To overcome this, WorldWind implements a widely used method of sampling the window’s color buffer to detect intersection, and makes this method easy for layers to use.
The method works as follows: The frame controller precedes a pick traversal by first setting the current view’s viewport to the specified pick region and clearing the color buffer in that region. This clearing occurs in the window’s back buffer and is therefore not visible to the user. During traversal, each layer draws itself not in its normal colors but in a set of colors that serve as pick identifiers. Since the result of pick traversal is never displayed, the specific colors used don’t matter visually. Each individual pickable item within a layer is drawn with a unique color that makes the item individually identifiable in the color buffer. By reading the region of the color buffer corresponding to the pick region, the specific items intersecting the region can be determined. The layer performs this read and makes this determination after drawing its pickable items.
Since one layer does not know how subsequently traversed layers might overwrite or otherwise affect it once drawn, items it determines have been picked could end up obscured by other layers. The items that intersect the pick region and are visible can be determined only after all layers are drawn. The frame controller therefore reads the final colors from the pick region of the color buffer and passes them to the list of picked items so that those items can compare their pick identifiers with the final colors and mark themselves as «on top.» The application then receives the full list of picked items, with the truly visible ones marked as such.
WorldWind provides utility classes to make it simple for layers to participate in this picking scheme. See PickSupport
Use of Proxies
-
— indicates the proxy host address — indicates the port to use on that host — One of the values defined by java.net.Proxy.Type
After these values are set, all retrievals from the network will go through the specified proxy.
Offline Mode
WorldWind’s use of the network can be disabled by calling WorldWind.setOfflineMode(boolean) . Prior to attempting retrieval of a network resource — anything addressed by a URL — WorldWind checks the offline-mode setting and does not attempt retrieval if the value is true.
Path Types
There is only one way to draw a straight line on a plane, but there are several ways to draw a straight line on the surface of a globe. Most shapes support the following path types:
Web WorldWind
To access even more Web WorldWind tutorials, please visit our Workshop Demo.
Basics
Common Problems
Some of the common issues users face and ways to resolve them.
Simplest Example
Shows the simplest way to get started with Web WorldWind.
Event and Gesture Handling
How to manage cursor or tactile input.
Layers
WorldWind's primary content display container.
Setup
Configuration
Illustrates the WorldWind configuration options and how to set them.
Deployment
Methods for deploying Web WorldWind.
Offline Example
Describes the how to host Web WorldWind on your own HTTP server.
Architecture
Concepts
Describes the architecture of Web WorldWind.
WorldWindow
Notes on the fundamental WorldWind object.
Navigation and Shapes
Navigation and Viewing
Positioning and orienting the view.
Picking
Picking capabilities and setup.
Shapes
Description of the properties of Shapes in Web WorldWind.
Dear WorldWind Community,
We added a new Showcase section to the website featuring a curated list of third-party geospatial software projects that show what the developer community has built with the WorldWind Planetary Globe Engine.
Please note that these projects are developed independently and externally from NASA leveraging WorldWind’s public, open-source release unless stated otherwise in their description.
If you desire to submit a project to be considered for its inclusion in she Showcase section, reach out to the WorldWind team at:
Please add the subject “Showcase submission” or simply use the link above.
Стряхнём пыль с глобуса: проверяем проект NASA World Wind
Иногда полезно оглянуться и посмотреть, как мог помочь анализатор в старых проектах, и каких ошибок можно своевременно избежать, если использовать анализатор регулярно. В этот раз выбор пал на проект NASA World Wind, который до 2007 года разрабатывался на языке C#.
NASA World Wind — это интерактивный глобус, позволяющий увидеть любое место на Земле. Для работы проект использует базу публичных снимков со спутника Landsat и проект моделирования рельефа Shuttle Radar Topography Mission. Первые версии проекта создавались на языке С#. Позже проект продолжил своё развитие на языке Java. Последняя выпущенная на C# версия — 1.4. Хотя C# версия уже много лет как заброшена, это не помешает нам проверить проект и оценить качество кода, разработчиком которого является NASA Ames Research Center.
Зачем мы проверили старый проект? Нам давно предлагали проверить что-то из проектов NASA и вот мы случайно набрели на этот проект. Да, эта проверка не принесёт никакой пользы проекту. Но такой цели в этот раз мы и не ставили. Мы просто хотели в очередной раз продемонстрировать пользу, которую может приносить статический анализатор кода PVS-Studio при разработке, в том числе и компании NASA.
Для анализа проекта использовался анализатор PVS-Studio версии 6.06.
Плотность ошибок
После проверки проекта анализатор выдал 120 предупреждений первого уровня и 158 предупреждение второго уровня. После изучения сообщений я считаю, что код стоит исправить в 122 местах. Таким образом, процент ложных срабатываний составил 56%. Это значит, что каждое второе сообщение указывает на ошибку или явно плохой код, нуждающийся в исправлении.
Теперь рассчитаем плотность ошибок. Всего в проекте, с учётом комментариев, 474240 строк кода в 943 файлах. Среди них 122 проблемных мест. Получаем, что анализатор в среднем находит 0,25 ошибки на 1000 строк кода. Это говорит о высоком качестве кода.
Эффект последней строки
-
The ‘X’ variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 40, 38. Point3d.cs 40
Здесь мы видим классическую ошибку в конструкторе копирования. При присваивании трёхмерных координат объекта вместо задания переменой Z было дважды перезаписано значение переменной X. Вполне очевидно, что эта ошибка была допущена в результате использования «Copy-Paste методики». Шанс допустить ошибку в последней строке при копировании кода гораздо выше. Подробней об этом феномене можно почитать в статье Андрея Карпова «Эффект последней строки». Для исправления этого конструктора требуется заменить переменную в последней строке.
Это не единственная ошибка в проекте, которая подтверждает этот эффект. В продолжении статьи встретится ещё несколько примеров, доказывающих его.
- V3008 The ‘this._imagePath’ variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 270, 263. ImageLayer.cs 270
- V3008 The ‘m_PolygonFill’ variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1623, 1618. ShapeFileLayer.cs 1623
Логическая ошибка или коварная опечатка?
-
The use of ‘if (A) <. >else if (A) <. >‘ pattern was detected. There is a probability of logical error presence. Check lines: 2111, 2197. KMLImporter.cs 2111
Ошибка копирования
-
Possible null dereference. Consider inspecting ‘m_gpsIcon’. GpsTrackerPlugin.SourceSetup.cs 68
Невыполняемое условие
-
Possibly an incorrect variable is compared to null after type conversion using ‘as’ keyword. Check variables ‘obj’, ‘robj’. RenderableObject.cs 199
Доступ по нулевой ссылке
-
Expression ‘this.linePoints != null’ is always true. PathLine.cs 346 The ‘this.linePoints’ object was used before it was verified against null. Check lines: 332, 346. PathLine.cs 332
Всегда ложное условие
-
A part of conditional expression is always false: currentSurfaceImage == null. SurfaceTile.cs 1069
- V3063 A part of conditional expression is always true: iWildIndex==-1. GPSTrackerPlugin.APRS.cs 87
- V3063 A part of conditional expression is always true: iWildIndex==-1. GPSTrackerPlugin.NMEA.cs 169
- V3063 A part of conditional expression is always false: newvalue == null. SchemaTypes.cs 860
Блуждающая скобка
-
It is possible that this ‘else’ branch must apply to the previous ‘if’ statement. GPSTrackerPlugin.File.cs 314
Неиспользованный параметр
-
Parameter ‘vertex2’ is not utilized inside method’s body. CPolygon.cs 227
Помимо опечатки во время присваивания, замечена ещё одна странность. Зачем присваивать фиксированное значение в каждой итерации цикла? Внутри цикла значение не меняется и гораздо логичнее сделать это присваивание один раз до его начала.
Перезапись параметра функции
-
Parameter ‘fDistance’ is always rewritten in method body before being used. GPSTrackerPlugin.WorldWind.cs 1667
Неверная проверка NaN
-
Comparison of ‘icon.OnClickZoomAltitude’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. Icon.cs 389
- V3076 Comparison of ‘icon.OnClickZoomHeading’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. Icon.cs 389
- V3076 Comparison of ‘icon.OnClickZoomTilt’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. Icon.cs 389
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 642
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 642
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 645
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 650
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 677
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 681
- V3076 Comparison of ‘m_ScalarFilterMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 886
- V3076 Comparison of ‘m_ScalarFilterMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 894
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1038
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1038
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1041
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1046
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1073
- V3076 Comparison of ‘m_ShapeTileArgs.ScaleMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1077
- V3076 Comparison of ‘m_ScalarFilterMin’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1259
- V3076 Comparison of ‘m_ScalarFilterMax’ with ‘double.NaN’ is meaningless. Use ‘double.IsNaN()’ method instead. ShapeFileLayer.cs 1267
Игнорирование результата функции
-
The return value of function ‘Combine’ is required to be utilized. ConfigurationLoader.cs 943
- V3010 The return value of function ‘Combine’ is required to be utilized. ConfigurationLoader.cs 1361
- V3010 The return value of function ‘Combine’ is required to be utilized. ConfigurationLoader.cs 1566
- V3010 The return value of function ‘Combine’ is required to be utilized. ConfigurationLoader.cs 1687
- V3010 The return value of function ‘Replace’ is required to be utilized. WorldWind.cs 2455
Пропущенное значение Enum
-
The switch statement does not cover all values of the ‘MenuAnchor’ enum: Left. Menu.cs 1681
Бессмысленное присваивание
-
An odd sequence of assignments of this kind: A = B; B = A;. Check lines: 625, 624. QuadTile.cs 625
Многократное присваивание
-
The ‘num1’ variable is assigned to itself. PlaceFinder.cs 2011 The ‘num1’ variable is assigned to itself. PlaceFinder.cs 2012
Небезопасный вызов обработчика события
-
Unsafe invocation of event ‘Elapsed’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. TimeKeeper.cs 78
Кстати, это очень коварный вид ошибки, так как проблемы будут возникать крайне редко, а воспроизвести их повторно будет вообще почти невозможно!
- V3083 Unsafe invocation of event ‘Navigate’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. InternalWebBrowser.cs 65
- V3083 Unsafe invocation of event ‘Close’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. InternalWebBrowser.cs 73
- V3083 Unsafe invocation of event ‘OnMouseEnterEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WavingFlagLayer.cs 672
- V3083 Unsafe invocation of event ‘OnMouseLeaveEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WavingFlagLayer.cs 691
- V3083 Unsafe invocation of event ‘OnMouseUpEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WavingFlagLayer.cs 1105
- V3083 Unsafe invocation of event, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. TreeNodeWidget.cs 325
- V3083 Unsafe invocation of event ‘OnVisibleChanged’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. FormWidget.cs 721
- V3083 Unsafe invocation of event ‘OnResizeEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. FormWidget.cs 1656
- V3083 Unsafe invocation of event ‘OnMouseEnterEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. PictureBox.cs 351
- V3083 Unsafe invocation of event ‘OnMouseLeaveEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. PictureBox.cs 362
- V3083 Unsafe invocation of event ‘OnMouseUpEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. PictureBox.cs 590
- V3083 Unsafe invocation of event ‘OnMouseEnterEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WorldWind.Widgets.PictureBox.cs 282
- V3083 Unsafe invocation of event ‘OnMouseLeaveEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WorldWind.Widgets.PictureBox.cs 293
- V3083 Unsafe invocation of event ‘OnMouseUpEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WorldWind.Widgets.PictureBox.cs 511
- V3083 Unsafe invocation of event ‘OnVisibleChanged’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. WorldWindow.Widgets.Form.cs 184
- V3083 Unsafe invocation of event ‘StatusChanged’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. ScriptPlayer.cs 57
- V3083 Unsafe invocation of event ‘Navigate’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 608
- V3083 Unsafe invocation of event ‘ReadyStateChanged’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 578
- V3083 Unsafe invocation of event ‘UpdateUI’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 568
- V3083 Unsafe invocation of event ‘HtmlKeyPress’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 587
- V3083 Unsafe invocation of event ‘HtmlEvent’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 600
- V3083 Unsafe invocation of event ‘BeforeNavigate’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 635
- V3083 Unsafe invocation of event ‘BeforeShortcut’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 626
- V3083 Unsafe invocation of event ‘BeforePaste’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 644
- V3083 Unsafe invocation of event ‘ContentChanged’, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. HtmlEditor.cs 615
Небезопасный объект для блокировки
-
Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.APRS.cs 256
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 226
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 244
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 370
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 416
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 448
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.File.cs 723
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.WorldWind.cs 339
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.WorldWind.cs 394
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.WorldWind.cs 468
- V3090 Unsafe locking on an object of type ‘String’. GPSTrackerPlugin.WorldWind.cs 538
- V3090 Unsafe locking on an object of type ‘String’. GPSTracker.cs 3853
- V3090 Unsafe locking on an object of type ‘String’. GPSTracker.cs 6787
- V3090 Unsafe locking on a type. All instances of a type will have the same ‘Type’ object. JHU_Globals.cs 73
- V3090 Unsafe locking on a type. All instances of a type will have the same ‘Type’ object. JHU_Globals.cs 222
- V3090 Unsafe locking on a type. All instances of a type will have the same ‘Type’ object. JHU_Log.cs 145
Использование & вместо &&
- V3093 The ‘&’ operator evaluates both operands. Perhaps a short-circuit ‘&&’ operator should be used instead. utils.cs 280
- V3093 The ‘&’ operator evaluates both operands. Perhaps a short-circuit ‘&&’ operator should be used instead. utils.cs 291
Лишний код
-
An excessive type cast. The object is already of the ‘IWidget’ type. PanelWidget.cs 749
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. FormWidget.cs 1174
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 80
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 219
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 244
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 269
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 294
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 313
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 337
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 362
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 387
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. RootWidget.cs 412
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 24
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 148
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 167
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 186
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 204
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 222
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWind.Widgets.RootWidget.cs 246
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. WorldWindow.Widgets.Form.cs 429
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_FormWidget.cs 1132
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 80
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 215
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 240
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 265
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 290
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 315
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 340
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 365
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_RootWidget.cs 390
- V3051 An excessive type cast. The object is already of the ‘IWidget’ type. JHU_PanelWidget.cs 744
Странный код
-
There are two ‘if’ statements with identical conditional expressions. The first ‘if’ statement contains method return. This means that the second ‘if’ statement is senseless HtmlEditor.cs 1480
Заключение
Как уже не раз говорилось, активное использование копирования кода приводит к частым ошибкам, и этого достаточно сложно избежать. Однако, копирование кода — это слишком удобно, и отказаться от него на практике нет никакой возможности. К счастью, как видите, анализатор PVS-Studio может помочь предотвратить множество ошибок, связанных с копирование кода и опечатками. Предлагаю не откладывать и попробовать его на своём проекте: скачать.
Если хотите поделиться этой статьей с англоязычной аудиторией, то прошу использовать ссылку на перевод: Alexander Chibisov. Dusting the globe: analysis of NASA World Wind project.