| 166 | } |
| 167 | |
| 168 | function isSameRasterUrl(urlA, urlB) { |
| 169 | if (urlA === urlB) { |
| 170 | return true; |
| 171 | } |
| 172 | const uriA = new URL(urlA); |
| 173 | const uriB = new URL(urlB); |
| 174 | if (uriA.origin !== uriB.origin) { |
| 175 | return false; |
| 176 | } |
| 177 | const regex = /\/([^/?#]+\.\w+)$/; |
| 178 | const pathA = uriA.pathname.replace(regex, ''); |
| 179 | const pathB = uriB.pathname.replace(regex, ''); |
| 180 | |
| 181 | // 3. 判断子路径关系 |
| 182 | return pathA === pathB || pathA.startsWith(pathB + (pathB.endsWith('/') ? '' : '/')); |
| 183 | } |
| 184 | |
| 185 | export function isSameRasterLayer(sourceInfo, compareSource) { |
| 186 | const { type, tiles } = sourceInfo; |